Skip to content

Series/Dataframe to_csv inconsistency when path=None [0.14.1] #8215

Closed
@ischwabacher

Description

@ischwabacher

It looks like Series.to_csv and DataFrame.to_csv differ in their handling of path=None:

In [1]: import pandas as pd

In [2]: print pd.Series([1, 1, 1], index=[1, 2, 3]).to_csv(None)
None

In [3]: print pd.DataFrame([1, 1, 1], index=[1, 2, 3]).to_csv(None)
,0
1,1
2,1
3,1

I haven't gone digging yet but I expect these two methods share enough code that this is a trivial fix.

Activity

added
IO CSVread_csv, to_csv
Compatpandas objects compatability with Numpy or Python functions
on Sep 8, 2014
added this to the 0.15.1 milestone on Sep 8, 2014
onesandzeroes

onesandzeroes commented on Sep 9, 2014

@onesandzeroes
Contributor

The behaviour of DataFrame.to_csv() is explicitly mentioned in the docstring, so I think it's best to change the series method to reflect that. Putting together a PR now.

modified the milestones: 0.15.0, 0.15.1 on Sep 9, 2014
jreback

jreback commented on Sep 9, 2014

@jreback
Contributor

closed by #8220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compatpandas objects compatability with Numpy or Python functionsIO CSVread_csv, to_csv

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jreback@onesandzeroes@ischwabacher

        Issue actions

          Series/Dataframe to_csv inconsistency when path=None [0.14.1] · Issue #8215 · pandas-dev/pandas