Skip to content

Instantly share code, notes, and snippets.

@mikedewar
mikedewar / df2json.py
Created December 16, 2011 13:17
A little script to convert a pandas data frame to a JSON object. Is there a better way?
"""
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],