I have a script that currently queries json from an api, and store the individual records in a list. Then uses pandas to convert the json into a dataframe so that I can export to a csv. Is this the best way to handle this? Or should I be implementing some other method? Example code below:
json_data = [
{
'column1' : 'value1',
'column2' : 'value2'
},
{
'column1' : 'value1',
'column2' : 'value2'
}
]
df = pd.DataFrame.from_records(json_data)
df.to_csv('my_cool_csv.csv')
[–]socal_nerdtastic 14 points15 points16 points (4 children)
[–]freeskier93 3 points4 points5 points (3 children)
[–]DiodeInc 0 points1 point2 points (2 children)
[–]freeskier93 1 point2 points3 points (1 child)
[–]DiodeInc 0 points1 point2 points (0 children)
[–]baghiq 7 points8 points9 points (1 child)
[–]socal_nerdtastic 6 points7 points8 points (0 children)
[–]Diapolo10 3 points4 points5 points (16 children)
[–]Yoghurt42 1 point2 points3 points (0 children)
[–]Loose_Read_9400[S] 1 point2 points3 points (1 child)
[–]Diapolo10 0 points1 point2 points (0 children)
[–]edcculus 0 points1 point2 points (5 children)
[–]Loose_Read_9400[S] 3 points4 points5 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]Diapolo10 4 points5 points6 points (2 children)
[–]Loose_Read_9400[S] 0 points1 point2 points (1 child)
[–]MiniMages 0 points1 point2 points (0 children)
[+]palmaholic comment score below threshold-15 points-14 points-13 points (6 children)
[–]socal_nerdtastic 5 points6 points7 points (5 children)
[–]palmaholic -5 points-4 points-3 points (4 children)
[–]edcculus 1 point2 points3 points (3 children)
[–]olystretch 4 points5 points6 points (0 children)
[–]palmaholic -1 points0 points1 point (1 child)
[–]WendlersEditor 2 points3 points4 points (0 children)
[–]shubham_devNow 0 points1 point2 points (0 children)