Pandas: pd.to_csv gives '__init__() got an unexpected keyword argument 'tupleize_cols'`

Created on 21 Jul 2019  路  4Comments  路  Source: pandas-dev/pandas

Hi, I have an issue which might be related to this:

I'm running the following basic code:

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

which used to run normally until yesterday. Yesterday morning I upgraded to pandas 0.25.0 while running code and now I cannot write a 500k rows (single-level indexed) 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 (Edit: 6.0.0 - upgraded with Administrator permissions - errors still persist) 
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._

Edit:

With Admin privileges it managed to upgrade Jupyter.

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.

P.S.: Any help on how to save the DataFrame (~12 GB) is also appreciated!

Usage Question

Most helpful comment

I just had the same issue but for me it was an incompatibility between numpy and pandas.

  • I had pandas 0.23.x and to_csv worked fine
  • I updated to pandas 0.25 for new functionality and it broke
  • I updated numpy 1.15.0 to 1.17.0 and it worked again

I am not sure if you guys classify that as a bug

All 4 comments

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.

Unfortunately this sounds like more of an issue with your configuration than pandas, and it's almost impossible to advise anything there. If you get a traceback from Jupyter you can maybe try there but again will be hard to say

I do not want to close the notebook as this will delete the dataFrame.

I'm not sure you can upgrade / downgrade versions and have it take effect while a notebook is running

Thanks - indeed it seems it goes deeper than just pandas

I just had the same issue but for me it was an incompatibility between numpy and pandas.

  • I had pandas 0.23.x and to_csv worked fine
  • I updated to pandas 0.25 for new functionality and it broke
  • I updated numpy 1.15.0 to 1.17.0 and it worked again

I am not sure if you guys classify that as a bug

got the same error. downgraded pandas to 0.24.2 and worked again!
numpy is 1.16.3

Was this page helpful?
0 / 5 - 0 ratings