python - Read very large Json file and store in data frame -


i having trouble store data obtain large json dataset, data contain 638151 rows , each row has following format: enter image description here

i used following code read json file:

def load_data(file):     open(file, 'r') f:         data = (json.loads(line) i, line in enumerate(f.readlines()))     return data  

the code return generator data quite large return whole dictionary. create dataframe dictionary by:

data = load_data('user_dedup.json') pd.dataframe([i in data]) 

i sent error: jsondecodeerror: unterminated string starting at: line 1 column 126 (char 125). happen if run whole dataset, if run sub-file (about 126 lines) code worked fine. checked several posts , said format of file not complete in opinion may happen because data large convert dataframe. not sure opinion. hope suggest reason , solutions solve it. thanks


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -