score:23
Accepted answer
Transform your date index back into a simple data column with reset_index
, and then generate your json object by using the orient='index'
property:
In [11]: aggregated_df.reset_index().to_json(orient='index')
Out[11]: '{"0":{"created":"05-16-13","counter":3},"1":{"created":"05-17-13","counter":1},"2":{"created":"05-18-13","counter":1}}'
Source: stackoverflow.com
Related Query
- How can I efficiently move from a Pandas dataframe to JSON
- How to move my pandas dataframe to d3?
- How can I efficiently convert data from string to int within a d3 method chain?
- How can I pass json data returned from a webservice into D3.json(...)?
- How to convert to nested json from dataframe
- How to generate JSON from a pandas data frame for dynamic d3.js tree
- D3.js: How can I tell apart JSON data from JSON file/endpoint
- In D3 Sankey, how can I load the from objects or arrays instead of either json or csv files?
- How can I use my data from a JSON string to populate dimple d3.js line chart?
- Using D3 loaded with json file, How can get parent nodes value from json file?
- how can I exclude an element from an Angular scope?
- How can I keep tick marks from repeating when I have a small number of dates on an nvd3 chart
- How to load data from an internal JSON array rather than from an external resource / file for a collapsible tree in d3.js?
- How can I perform this d3.js magic (Grouped Bar Chart) with JSON rather than CSV?
- How to store a JSON object loaded from a file?
- How can I remove a line from the 110m TopoJson world map?
- How to assign the x-axis position of a node in a Sankey Diagram (D3) from the json file
- D3 Library — How To Access Data from JSON in this example
- How can I rotate d3 chart and how can I start pie chart from angle -90?
- How can D3 select multiple shapes with shared attributes from a group?
- How do I use d3.domain to get d3.min and d3.max from multiple columns in a JSON file?
- how can i group JSON data into the weeks according to calender?
- how to add tooltip for rectangles in d3.js reading from json
- How to get the specific JSON array from a value in that array
- D3.js : How to read data from JSON in Grouped Bar Chart
- How can I get a list of tree-ancestors and tree-descendants from this d3.js layout.tree?
- D3js-Topojson : how to move from pixelized to Bézier curves?
- D3.js HTML table from JSON file-- How to create empty values so there aren't missing <td> elements?
- How can I color one Y-axis line different from the other grid-lines?
- How to use python pandas to get intersection of sets from a csv file
More Query from same tag
- Text not wrapping in d3 SVG element even when using Bostock's wrap function
- How to highlight an array of words in D3 word cloud
- D3.JS bar graph in Firefox cshtml
- d3.js plot not displaying within R Shiny plot area
- How do you plot a line using scaleOrdinal in D3.js?
- is it possible to color groups differently
- Blank page using d3 mbostock
- Convert dc.js chart to pdf
- d3.js treemap new data doesn't render
- How can I make a bar chart starting from the 0 point of the y axis and not from the bottom of the svg?
- How to change the circles style using d3.js
- Displaying SVGs on HTML page
- Using d3.json to query a sinatra app works fine on localhost, but fails with forbidden when deployed
- NetworkD3 Sankey Plot in R: How to switch text labels from the right to the left of the inner nodes only
- How to stop Firefox firing mouseleave when DOM node is moved in the DOM?
- Conditionally modify selection content with D3
- D3.js: Don't start new transition until the previous one has finished?
- D3js External JavaScript file
- Register mouse events on overlapping Elements
- How to add Custom value in timeFormat d3?
- set zoom after each redraw
- Why is the line in my D3 chart inverting?
- Adding Pan Zoom to d3js force directed
- Load Big Data using D3 without performance degradation
- D3.js V5 - Why is my bar chart axis not scaling?
- Converting d3.js SVG code to a standalone program — Example?
- How to link county and data on hover in D3.js
- padAngle function in d3 arc throwing error
- D3.tip is not a function
- d3.js - rotate axis and boxes together