通过pandas将json文件导出到csv,要花很长时间,这正常吗?

0 人关注

我试着用pandas将一个json文件导出到csv文件中,但操作持续了几个小时都没有结束。我很确定代码不是问题,而是我导出数据的方式。有没有可能是json文件太重了?

Here is the code:

import json 
import pandas as pd
from datetime import datetime, timedelta
search_date = datetime(2019, 8, 4)
nextSequence = timedelta(days=9)
path = 'C:/Users/coppe/dox/Drivy/' 
new_car_list = []
while search_date <= datetime(2019, 12, 17):
    if search_date == datetime(2019, 12, 8):
    else:
        file = str(datetime.date(search_date)) + '/' + str(datetime.date(search_date)) + '_final'+ '.json'
        with open(path + file) as json_file:  
            cars = json.load(json_file)    
            json_file.close()
        for car in cars:
            new_car_list.append(car)
        search_date += nextSequence