I have a json file of size less than 1Gb.I am trying to read the file on a server that have 400 Gb RAM using the following simple command:
df = pd.read_json('filepath.json')
However this code is taking forever (several hours) to execute,I tried several suggestions such as
df = pd.read_json('filepath.json', low_memory=False)
or
df = pd.read_json('filepath.json', lines=True)
But none have worked. How come reading 1GB file into a server of 400GB be so slow?
import json; d=json.load(open('filepath.json')); df=pd.DataFrame(d)?pandas.read_jsonis not fast, I don't think it will take several hours (It's just a wild guess). I suspect that your table has too many columns, orpandas.read_jsonis reading it that way. pandas is terrible at handling tables with too many columns. For example,pd.DataFrame([range(100000)])will take more than one second to create. Please check how many rows and columns your table has.