-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Nrows cannot be zero for read_csv. Fixes #21141 #21431
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
@@ -995,11 +995,18 @@ def test_read_excel_nrows_greater_than_nrows_in_file(self, ext): | |||
|
|||
def test_read_excel_nrows_non_integer_parameter(self, ext): |
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.
Would be better to parametrize this test for cases like [-1, 0, '1']
instead of having separate tests
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.
@WillAyd sure, I will make these changes as soon as we decide if we are keeping this PR :)
@@ -375,6 +375,9 @@ def test_read_nrows(self): | |||
with tm.assert_raises_regex(ValueError, msg): | |||
self.read_csv(StringIO(self.data1), nrows=-1) | |||
|
|||
with tm.assert_raises_regex(ValueError, msg): |
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 you reference the issue number in a comment above this line.
I'm not sure about disallowing
I doubt you lose much performance by using |
@jschendel : Good to know. In the case of your example, couldn't you just read the first line of the file using the builtin |
Yeah, I'm not saying that it's the right solution, just that it's a solution people are likely using. Certainly more concise than using |
@jschendel : Nope, that's totally fair. Let's deprecate then. @cgopalan : Can you update your PR to deprecate |
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.
nrows=0 is valid
the combinations of options is invalid
pr needs to limit scope
@jreback : In any case, should we just disallow that combination of inputs then? If |
Codecov Report
@@ Coverage Diff @@
## master #21431 +/- ##
=======================================
Coverage 91.89% 91.89%
=======================================
Files 153 153
Lines 49596 49596
=======================================
Hits 45576 45576
Misses 4020 4020
Continue to review full report at Codecov.
|
@jreback @gfyoung i too agree that just the value of |
no reason to remove or even deprecate |
@jreback so |
yeah i thought that was fine |
@jreback : 🤦♂️ well, I guess we're heading back there then. 😄 |
@gfyoung should i delete this branch? |
@cgopalan : Sure thing. |
git diff upstream/master -u -- "*.py" | flake8 --diff