-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Allow empty chunksize in stata reader when using iterator #37302
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
Conversation
pandas/io/stata.py
Outdated
"chunksize must be set to a positive integer to use as an iterator." | ||
) | ||
return self.read(nrows=self._chunksize or 1) | ||
self._chunksize = 1 if self._chunksize is None else self._chunksize |
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.
is there validation when chunsize is passed in?
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.
It is not checked when set. I've refactored the code to not rely on chunksize being set to determine if an iterator is being used.
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.
what i mean is what if someone passes chunksize<=0
? do we appropriately raise
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.
Yes, there is explicit validation to ensure that it is an int
that is >0
Lines 1049 to 1052 in b2ea05f
if self._chunksize is None: | |
self._chunksize = 1 | |
elif not isinstance(chunksize, int) or chunksize <= 0: | |
raise ValueError("chunksize must be a positive integer when set.") |
can you add a what's new note for the precision loss change (1.1.4) |
also pls merge master |
a1e2b9a
to
574eebd
Compare
I rebased on master and added a what's new. |
574eebd
to
5ad63c0
Compare
5ad63c0
to
54dc791
Compare
small conflict and pls rebase |
54dc791
to
2bfc4ae
Compare
Remvoe error message inorrectl added Fixed new issues identified by mypy Add test to ensure conversion of large ints is correct closes pandas-dev#37280
2bfc4ae
to
b2ea05f
Compare
thanks @bashtage |
@meeseeksdev backport 1.1.x |
…der when using iterator
…ta reader when using iterator) (#37364) * Backport PR #37302: BUG: Allow empty chunksize in stata reader when using iterator * remove match argument to assert_produces_warning Co-authored-by: Kevin Sheppard <[email protected]> Co-authored-by: Simon Hawkins <[email protected]>
Remvoe error message inorrectl added Fixed new issues identified by mypy Add test to ensure conversion of large ints is correct closes pandas-dev#37280
Remvoe error message inorrectl added Fixed new issues identified by mypy Add test to ensure conversion of large ints is correct closes pandas-dev#37280
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff