Tutorial by Examples

can either pass string of the json, or a filepath to a file with valid json In [99]: pd.read_json('[{"A": 1, "B": 2}, {"A": 3, "B": 4}]') Out[99]: A B 0 1 2 1 3 4 Alternatively to conserve memory: with open('test.json') as f: data = pd.Da...
def to_flare_json(df, filename): """Convert dataframe into nested JSON as in flare files used for D3.js""" flare = dict() d = {"name":"flare", "children": []} for index, row in df.iterrows(): parent = row[...
Content of file.json (one JSON object per line): {"A": 1, "B": 2} {"A": 3, "B": 4} How to read directly from a local file: pd.read_json('file.json', lines=True) # Output: # A B # 0 1 2 # 1 3 4

Page 1 of 1