Skip to content

.to_csv fails: "line_terminator" has been renamed to "lineterminator" in pandas-1.5.0 #13

@GabiBaumann

Description

@GabiBaumann

.to_csv fails with the message:

"""
<spss_converter.Metadata.Metadata object at 0x7fa53c6ebf90>
Traceback (most recent call last):
File "/home/andre/Python/Export_CSV/converter-skeleton.py", line 6, in
bla = spss_converter.to_csv('source.sav', line_terminator = '\n')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/andre/Python/Export_CSV/venv/lib/python3.11/site-packages/spss_converter/read.py", line 428, in to_csv
result = df.to_csv(target,
^^^^^^^^^^^^^^^^^
TypeError: NDFrame.to_csv() got an unexpected keyword argument 'line_terminator'
"""

The pandas doc [1] tells me:
"""
lineterminator str, optional

The newline character or character sequence to use in the output file. Defaults to os.linesep, which depends on the OS in which this method is called (’\n’ for linux, ‘\r\n’ for Windows, i.e.).

Changed in version 1.5.0: Previously was line_terminator, changed for consistency with read_csv and the standard library ‘csv’ module.

"""
[1]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions