This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
tiny script to convert a pandas data frame into a JSON object | |
orig: https://gist.github.com/1486027 via Mike Dewar | |
Test data: | |
df = pandas.DataFrame({ | |
"time" : [1,2,3,4,5], | |
"temp" : np.random.rand(5) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
tiny script to convert a pandas data frame into a JSON object | |
""" | |
import ujson as json | |
import pandas | |
import numpy as np | |
df = pandas.DataFrame({ | |
"time" : [1,2,3,4,5], |