Skip to content

BUG: DataFrame to_csv compression with 'zip' use zipfilename as archive name #39465

Closed
@CyberQin

Description

@CyberQin
  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


a=pd.DataFrame({'a':[1,2,3,4,5],'b':[4,5,6,7,8]})
a.to_csv('myfile.csv.zip')

Problem description

when use gzip method, the function works fine, a.to_csv('myfile.csv.gz') will create a gzip file with an archive file named myfile.csv.
the "zip" method works bad,a.to_csv('myfile.csv.zip') will create a zipfile with an archive file named myfile.csv.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions