Created
December 28, 2020 22:13
-
-
Save aveek22/cd96bcef996d45db7c03059918b7bc69 to your computer and use it in GitHub Desktop.
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
# imports the Pandas library to work in python | |
import pandas as pd | |
# Create the data as a list | |
data = [['Bob', 30], ['Fred', 35], ['Nick', 40]] | |
# Load the data as a dataframe | |
df = pd.DataFrame(data=data, columns=['Name','Age']) | |
# Covnert the dataframe to JSON | |
json_data = df.to_json(orient="records") | |
print(json_data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment