Skip to content

Instantly share code, notes, and snippets.

@gitdagray
Last active February 18, 2018 18:46
Show Gist options
  • Save gitdagray/77fd5b8f801c4feb0aaedd08d7751c79 to your computer and use it in GitHub Desktop.
Save gitdagray/77fd5b8f801c4feb0aaedd08d7751c79 to your computer and use it in GitHub Desktop.
Converting pandas dataframes to JSON
#loop has completed
#end the Selenium browser session
driver.quit()
#combine all pandas dataframes in the list into one big dataframe
result = pd.concat([pd.DataFrame(datalist[i]) for i in range(len(datalist))],ignore_index=True)
#convert the pandas dataframe to JSON
json_records = result.to_json(orient='records')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment