-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: na_values with a dict of scalars #7119
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
try a bit non-intuitive, but that's what we ar testing on...prob a but not to accept a scalar |
read_
|
There was similar wart-y code very early on that required lists even for single variables. E.g., in dropna, etc. though I don't remember where exactly. Probably worth a patch. |
docs say list of strings but not hard to accept a dict of scalars/lists for a particular column (as a single scalar is accepted too) |
@jreback : #14056 resolves the second example. However, the behaviour for the first one is not entirely clear from documentation. Should we be able to accept column indices? At the moment, the answer appears to be no: >>> from pandas.compat import StringIO
>>> from pandas import read_csv
>>> data = 'a\nfoo\n1'
>>>
>>> read_csv(StringIO(data), na_values={0: 'foo'}, engine='c')
...
TypeError: Expected list, got set
>>> read_csv(StringIO(data), na_values={0: 'foo'}, engine='python')
a
0 foo
1 1 |
@gfyoung I think column indices are ok, except if a header is passed (in which case they must be the names; easiest to avoid conflict here). |
@jreback : Hmm...okay. In any case, I think this issue should be closed in favor of another one that specifically states that we can correctly process column indices. |
ok can u make one? |
I can't get
na_values
to work with a dictionary.On
The text was updated successfully, but these errors were encountered: