max () day_of_week = week = color = parties = for w in weeks : for idx, day in enumerate ( days ): day_of_week. We will need to have values for every # pair of year/month names. We’ll also create an array of color values based the number of parties for that day: # Set up the data for plotting. Now we’ll format the data for Bokeh, creating parallel arrays of our axis values and our data values. fillna ( value = 0 ) # Get our "weeks" and "days" weeks = list ( data. pivot ( index = 'week', columns = 'day_of_week', values = 'count' ) data = data. raw_data = ] raw_data = ] # Pivot our data to get the matrix we need data = raw_data. We’ll also create our weeks and days range and domain arrays: # Augment the data frame with the day of the week and the start of the week that it's in. Next we augment our data with a day_of_week index so we can then create a pivot table to build up a grid of our weekly data. We've aggregated it by date already, so we don't need to worry about paging query = ( "" "$group=date" "&call_type_code=507P" "&$select=date_trunc_ymd(dispatch_date) %20 AS %20 date %2 C %20 count(*)" "&$order=date" ) raw_data = pd. Pandas makes it super easy to read data from a JSON API, so we can just read our data directly using the read_json function: import numpy as np import pandas as pd import datetime import urllib from otting import * from bokeh.models import HoverTool from collections import OrderedDict # Read in our data. Note: Unfortunately the LAPD has since taken this dataset down, but we've left the query here as an example. Using a Wufoo form to write to a Socrata Dataset.Using a SSIS to write to a Socrata Dataset.Using Pentaho to Read data from Salesforce and Publish to Socrata.Pulling data from Hadoop and Publishing to Socrata.Gauge Visualizations using the Google Charts library.Visualizing data using the Google Calendar Chart.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |