1

When I am trying to save dataframe in json format. Getting below error. Size of df is 70+MB. pandas version : 0.23.4. Dataframe is having 90 columns and 165K records

df.to_json('df.json', orient='records')

    Could not reserve memory block
Traceback (most recent call last):
  File "C:/***/validate.py", line 70, in process_data
    df.to_json('df.json', orient='records')
  File "C:\***\venv\lib\site-packages\pandas\core\generic.py", line 1891, in to_json
    index=index)
  File "C:\***\venv\lib\site-packages\pandas\io\json\json.py", line 58, in to_json
    index=index).write()
  File "C:\***\venv\lib\site-packages\pandas\io\json\json.py", line 101, in write
    self.date_format == 'iso', self.default_handler)
  File "C:\***\venv\lib\site-packages\pandas\io\json\json.py", line 156, in _write
    iso_dates, default_handler)
  File "C:\***\venv\lib\site-packages\pandas\io\json\json.py", line 112, in _write
    default_handler=default_handler
OverflowError: Could not reserve memory block
Lijo Jose
  • 317
  • 1
  • 3
  • 13

0 Answers0