When I'm working on data analysis, I sometimes have to convert a large JSON file to CSV, and I've researched various things, but when I thought that there was no easy way to convert it, Pandas solved it with 3 lines. I made a note because he did it.
changer.py
#Import Pandas
import pandas as pd
#Load the JSON file you want to convert
df = pd.read_json("hogehoge.json")
#Convert to CSV and save as any file name
df.to_csv("hogehoge.csv")
That's it. Pandas really convenient.
Recommended Posts