Search code examples
pandasjupyter-notebookexport-to-csv

Cannot write pandas DataFrame to csv: __init__() got an unexpected keyword argument 'tupleize_cols'


I'm running the following basic code:

dfMain.to_csv('./January_filtered_International_WE.csv')

which used to run normally until yesterday. This morning I upgraded to pandas 0.25.0 while running code and now I cannot write my 500k rows dataframe to a csv. I can mention that I left Jupyter Notebook running in order to do some processing, so this morning when I opened it I had the dataFrame already, processed.

Versions (using Windows 10)

Jupyter notebook : 5.7.8
Python : 3.6.7
Pandas : 0.25.0

I would like to save my DataFrame in a fast and efficient manner as I will load it several times in the future. I do not want to close the notebook as this will delete the dataFrame.

I tried:

  • downgrading to Pandas 0.24.2 (previous version used) but still getting the __init__() got an unexpected keyword argument 'tupleize_cols'
  • use pd.to_pickle but got a memoryError
  • use pd.to_hdf but got a memoryError
  • using msgbox instead but apparently it does not support DataFrames (got an error)
  • upgrade Jupyter notebook, but got the following error:

ERROR: ipython 5.8.0 has requirement prompt-toolkit<2.0.0,>=1.0.4, but you'll have prompt-toolkit 2.0.9 which is incompatible

  • so naturally I did pip install prompt-toolkit 1.0.16 but then got this message:

ERROR: jupyter-console 6.0.0 has requirement prompt-toolkit<2.1.0,>=2.0.0, but you'll have prompt-toolkit 1.0.16 which is incompatible.

As an alternative I went into PyCharm and took a random DataFrame.to_csv and it worked. This makes me think the issue is with Jupyter Notebook.

Any help on how to save the DataFrame (~12 GB) is appreciated!


Solution

  • Re-installing Jupyter did the trick in my case