-
-
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
Accept range for list-requiring kwargs in pd.read_csv #17083
Conversation
Actually, they do because that's a refactoring, and it obfuscates the actual change you're making. You should separate that out as a separate PR. |
@jbrockmendel : Can you explain the motivation for this PR? Unless you plan to iterate through them (so that you don't have to load the entire sequence into memory), I'm have some difficulty understanding the benefit. |
OK. I've been a bit concerned about making multiple small PRs because they each run travis et al. I'll separate these out.
You can. The motivation is that user code that works in py2 should ideally work in py3. Is there some ambiguity as to what a user who passes |
While I understand the intention, I'm not sure that justifies us loosening our specifications, especially since it's really not inconvenient to use |
ff38aad
to
1eea06e
Compare
Sure the pandas devs should be practicing py3 habits, but when users have things that work in py2 and break in py3 for seemingly nitpicky reasons, that's just one more little bit of friction in the py3 transition process. It's counter-productive. I'm not interested in bike-shedding user-friendliness vs purity. I'll put the ndarray/nan bit in a separate PR. |
@jbrockmendel what I would accept here is an error message that raises on a non-scalar and non-list-like (IOW range). we are actually somewhat picky on array-like; these generally *mustY be fully materialized objects (though we do accept generaters generally). In this instance an exception is fine. |
I might also point out that you can use pandas' |
pd.read_csv(path, index_col=range(1))
currently breaks in py3. This PR fixes that.There are likely other functions and kwargs for which the same fix would be useful. I haven't tracked them all down.
Edits to
series
andframe
are unrelated, but not big enough to merit their own PR. This is just removing import ofnan, ndarray
that are used in a small number of places and instead usingnp.nan, np.ndarray
.git diff upstream/master -u -- "*.py" | flake8 --diff