Skip to content

add default zip file name in dataframe to_csv when use 'infer' + 'zip' method #39647

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

Closed
Closed
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
1905fcc
enhancement to dataframe to_csv zip method,add this step to perform l…
CyberQin Feb 7, 2021
91de735
REGR: fix transform of empty DataFrame/Series (#39639)
jorisvandenbossche Feb 7, 2021
a8cf281
REG: read_excel with engine specified raises on non-path/non-buffer (…
rhshadrach Feb 7, 2021
23a9b52
DOC: Clarify behavior for Series with dict-like data and index (#39374)
phofl Feb 7, 2021
627e01f
Fixed comment for pandas.unique (#39557) (#39643)
simonjayhawkins Feb 7, 2021
c075383
CLN refactor maybe-castable (#39257)
MarcoGorelli Feb 7, 2021
4028341
CLN: Use kwargs instead of kwds in apply functions (#39625)
rhshadrach Feb 7, 2021
ba60690
[PERF] taking upper 32bit of PyObject_Hash into account (#39592)
realead Feb 7, 2021
56b1c59
REF: remove Float64Index get_loc, __contains__ (#39620)
jbrockmendel Feb 7, 2021
47e5b1c
BUG: inspect.getmembers(Series) (#38782)
topper-123 Feb 7, 2021
83de190
ASV: add benchmarks for concatenating and appending of CategoricalInd…
avinashpancham Feb 7, 2021
d23a66f
BUG: Series[int].__setitem__(mask, td64_or_dt64) incorrect casting (#…
jbrockmendel Feb 7, 2021
f63e09d
CLN: Styler HTML output adopt structured code standard (#39627)
attack68 Feb 7, 2021
362f039
Fix select_dtypes(include='int') for Windows. (#36808)
Feb 7, 2021
c7acbde
cln: redundant function (#39632)
attack68 Feb 7, 2021
8d8f763
REGR: appending to existing excel file created corrupt files (#39605)
twoertwein Feb 7, 2021
102a34c
DOC: typo in 1.2.2 whatsnew (#39646)
arw2019 Feb 7, 2021
dfb19fe
enhancement to dataframe to_csv zip method,add this step to perform l…
CyberQin Feb 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pandas/io/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,17 @@ def __init__(
self.archive_name = archive_name
self.multiple_write_buffer: Optional[Union[StringIO, BytesIO]] = None

# add csv file name like gz or bz2
try:
fname = os.path.basename(file)
if not isinstance(fname, bytes):
fname = fname.encode('latin-1')
if fname.endswith(b'.zip'):
xname = fname[:-4].decode('latin-1')
self.archive_name=xname
except:
pass

kwargs_zip: Dict[str, Any] = {"compression": zipfile.ZIP_DEFLATED}
kwargs_zip.update(kwargs)

Expand Down