-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: set keyword argument so zipfile actually compresses #21144
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
86d2f72
set keyword argument so zipfile actually compresses
minggli 498451d
add compression size test case
minggli 012383f
add compression size test case
minggli a790148
add compression size test case
minggli 42f5c32
add compression size test case
minggli 74b8c34
update whatsnew
minggli c46fbe0
Merge branch 'master' into bugfix/zip
minggli f31fc3d
E302 expect 2 blank lines
minggli 3a29ab3
minor refactor of tests
minggli 4775cac
refactor tests
minggli fa6c433
parameterize objects
minggli adb6fd6
simplify construction
minggli 974b063
update whatsnew
jreback File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import pytest | ||
import os | ||
import collections | ||
from functools import partial | ||
|
||
import numpy as np | ||
|
||
from pandas import Series, Timestamp | ||
from pandas import Series, DataFrame, Timestamp | ||
from pandas.compat import range, lmap | ||
import pandas.core.common as com | ||
from pandas.core import ops | ||
|
@@ -222,3 +223,21 @@ def test_standardize_mapping(): | |
|
||
dd = collections.defaultdict(list) | ||
assert isinstance(com.standardize_mapping(dd), partial) | ||
|
||
|
||
@pytest.mark.parametrize('obj', [ | ||
DataFrame(100 * [[0.123456, 0.234567, 0.567567], | ||
[12.32112, 123123.2, 321321.2]], | ||
columns=['X', 'Y', 'Z']), | ||
Series(100 * [0.123456, 0.234567, 0.567567], name='X')]) | ||
@pytest.mark.parametrize('method', ['to_pickle', 'to_json', 'to_csv']) | ||
def test_compression_size(obj, method, compression): | ||
if not compression: | ||
pytest.skip("only test compression case.") | ||
|
||
with tm.ensure_clean() as filename: | ||
getattr(obj, method)(filename, compression=compression) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this fail under 0.23.0? (and works here clearly) |
||
compressed = os.path.getsize(filename) | ||
getattr(obj, method)(filename, compression=None) | ||
uncompressed = os.path.getsize(filename) | ||
assert uncompressed > compressed |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add tests and a
whatsnew
for this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, because you are modifying the default behavior, I'm not sure if we need a deprecation cycle for this (to be safe, we should I would imagine).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no this is a bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough, though tests and
whatsnew
are still needed (just to be clear).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks. added whatsnew and tests.