-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC/BUG: NA string in data gets read as NaN #4318
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
Comments
pass |
Ah. The doc for that isn't clear: |
so I think if you want NO values converted to NA's do maybe should put an example....(and/or make a bit clearer in docs) let us know if that works |
Definitely worked. I just think this might be a common problem, the docs don't make it clear at all about the behaviour, really convoluted. How about this: |
great |
Sure, happy to contribute. |
(if you use |
actually...just tested with with unfortunately
which prob works, but seems wrong.... (just needs a small change in |
Good spot! (I had only checked for "NA", which is NaN'd normally but left with keep_default_na=False.) |
ok I fixed the bug in #4374, what do you think we should change in the docstring/docs to make more clear? (If you put an updated text I can just paste it in) do we want to throw in an example? you are also welcome to do a PR here if you'd like... lmk |
Hi not sure what a PR is. "To customize what constitutes being read as NaN, use combination of keep_default_na and na_values. To completely override the behavior, set the former to False and send the overriding list of values that will be read as NaN to the latter. To simply add more values to the defaults (which are ['-1.#IND', '1.#QNAN', '1.#IND', '-1.#QNAN','#N/A N/A', 'NA', '#NA', 'NULL', 'NaN','nan']) you can pass the list that will be appended to na_values. pd.read_csv(path, keep_default_na=False, na_values=[""]) # nothing is a NaN |
a PR is a pull request 😄 |
@brainysmurf see the PR #4374, added some nice shiny docs on na_values/infinity parsing, should be a lot more clear. but pls comment if you feel that is not the case |
better docs for
keep_default_na
andna_values
when used togetherI have a field set where "NA" is meaningful, but not meaning "not applicable" (it refers to the name of my school's Homeroom). There's no obvious way to handle this edge case...
On 0.11.0
The text was updated successfully, but these errors were encountered: