Last answered:

19 Nov 2022

Posted on:

17 Nov 2022

1

__init__() got an unexpected keyword argument 'line_terminator'

This is the error message I got when trying the .to_csv command. I use a mac, could the directory referral code be different? Thanks

2 answers ( 0 marked as helpful)
Posted on:

17 Nov 2022

0
--------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/var/folders/nh/_j0wt0w523v76n_hsfkkn8mw0000gn/T/ipykernel_17211/3200195066.py in <module>
----> 1 mydata_01.to_csv('example_01.csv')

/opt/anaconda3/lib/python3.9/site-packages/pandas/core/generic.py in to_csv(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, compression, quoting, quotechar, line_terminator, chunksize, date_format, doublequote, escapechar, decimal, errors, storage_options)
   3549         header: bool_t | list[str] = True,
   3550         index: bool_t = True,
-> 3551         index_label: IndexLabel | None = None,
   3552         mode: str = "w",
   3553         encoding: str | None = None,

/opt/anaconda3/lib/python3.9/site-packages/pandas/io/formats/format.py in to_csv(self, path_or_buf, encoding, sep, columns, index_label, mode, compression, quoting, quotechar, line_terminator, chunksize, date_format, doublequote, escapechar, errors, storage_options)
   1159         """
   1160         Render dataframe as comma-separated file.
-> 1161         """
   1162         from pandas.io.formats.csvs import CSVFormatter
   1163 

TypeError: __init__() got an unexpected keyword argument 'line_terminator'
Instructor
Posted on:

19 Nov 2022

0

Hi Seth!

Thanks for reaching out.

Can you please support your question with the code you've executed, as well as with a screenshot containing the entire error message? Only then will we be able to provide a specific answer and assist you better. Thank you.

Looking forward to your reply.
Kind regards,
Martin

Submit an answer