Skip to content

pd.Series to_csv method does not recognize "compression" #18958

Closed
@jolespin

Description

@jolespin

There looks like something is wrong with the compression argument in to_csv forpd.Series but pd.DataFrame. This error is also in 0.20.3.

In [1]: Se_tmp = pd.Series(list("ACGT"))
   ...: Se_tmp.to_csv("~/test.tsv.gz", sep="\t", compression="gzip")
   ...:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-de7ce483228f> in <module>()
      1 Se_tmp = pd.Series(list("ACGT"))
----> 2 Se_tmp.to_csv("~/test.tsv.gz", sep="\t", compression="gzip")

TypeError: to_csv() got an unexpected keyword argument 'compression'

In [2]: Se_tmp.to_frame("testing_column").to_csv("~/test.tsv.gz", sep="\t", compression="gzip")

In [3]: pd.__version__
Out[3]: '0.21.1'

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignCompatpandas objects compatability with Numpy or Python functionsIO CSVread_csv, to_csv

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions