Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lineterminator in to_csv doesn't work #8206

Closed
cpcloud opened this issue Sep 7, 2014 · 4 comments
Closed

lineterminator in to_csv doesn't work #8206

cpcloud opened this issue Sep 7, 2014 · 4 comments
Labels
Bug IO CSV read_csv, to_csv
Milestone

Comments

@cpcloud
Copy link
Member

cpcloud commented Sep 7, 2014

In [3]: df = pd.DataFrame({'a': ['3.4', '34.400'], 'b': ['5,5', '10,200']})

In [4]: df
Out[4]:
        a       b
0     3.4     5,5
1  34.400  10,200

In [5]: df.to_csv(lineterminator='-')
Out[5]: ',a,b\n0,3.4,"5,5"\n1,34.400,"10,200"\n'

I would've expected

Out[5]: ',a,b-0,3.4,"5.5"-1,34.400,"10,200"-'
@cpcloud cpcloud added Bug IO CSV read_csv, to_csv labels Sep 7, 2014
@cpcloud cpcloud changed the title lineterminator doesn't work lineterminator in to_csv doesn't work Sep 7, 2014
@onesandzeroes
Copy link
Contributor

The argument in DataFrame.to_csv() is actually line_terminator, not lineterminator. A little confusing, since csv.writer uses the latter. The argument gets changed here.

Then I guess that confusion gets compounded by the fact that DataFrame.to_csv() accepts extra keyword args with a **kwds argument, but then doesn't seem to validate them. It only seems to use engine and cols from **kwds, so maybe the real issue here is that it should be warning if given unrecognized args?

@mangecoeur
Copy link
Contributor

definitely bad behaviour to accept invalid kwargs! if only engine and cols are used they should just be explicitly defined.

@jreback jreback added this to the 0.15.1 milestone Oct 2, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@gfyoung
Copy link
Member

gfyoung commented Jul 26, 2016

@jreback : the kwds parameter is not used anymore in to_csv - can't we just remove it now (0.19.0)?

@jorisvandenbossche
Copy link
Member

@gfyoung yep!

gfyoung added a commit to forking-repos/pandas that referenced this issue Jul 29, 2016
@jorisvandenbossche jorisvandenbossche modified the milestones: 0.19.0, Next Major Release Jul 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO CSV read_csv, to_csv
Projects
None yet
Development

No branches or pull requests

6 participants