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

BUG: Accept column indices for na_values in read_csv #14203

Closed
gfyoung opened this Issue Sep 11, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@gfyoung
Member

gfyoung commented Sep 11, 2016

>>> 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  # Should be NaN
1    1

This behaviour is slightly inconsistent with what we do with usecols for example, so it would be nice to be able to process column indices with na_values too.

xref #7119.

@jreback jreback added this to the Next Major Release milestone Sep 12, 2016

@gfyoung gfyoung changed the title from ENH: Accept column indices for na_values in read_csv to BUG: Accept column indices for na_values in read_csv Nov 26, 2016

@gfyoung

This comment has been minimized.

Show comment
Hide comment
@gfyoung

gfyoung Nov 26, 2016

Member

Reclassifying as a bug because the doc makes it sound like that this behaviour should be possible.

Member

gfyoung commented Nov 26, 2016

Reclassifying as a bug because the doc makes it sound like that this behaviour should be possible.

gfyoung added a commit to gfyoung/pandas that referenced this issue Nov 26, 2016

gfyoung added a commit to gfyoung/pandas that referenced this issue Nov 26, 2016

gfyoung added a commit to gfyoung/pandas that referenced this issue Nov 26, 2016

gfyoung added a commit to gfyoung/pandas that referenced this issue Nov 27, 2016

gfyoung added a commit to gfyoung/pandas that referenced this issue Nov 27, 2016

gfyoung added a commit to gfyoung/pandas that referenced this issue Dec 1, 2016

gfyoung added a commit to gfyoung/pandas that referenced this issue Dec 1, 2016

gfyoung added a commit to gfyoung/pandas that referenced this issue Dec 15, 2016

@jreback jreback modified the milestones: 0.19.2, Next Major Release Dec 15, 2016

@jreback jreback closed this in dd8cba2 Dec 16, 2016

ischurov added a commit to ischurov/pandas that referenced this issue Dec 19, 2016

BUG: Patch read_csv NA values behaviour
Patches the following behaviour when `na_values` is passed in as a
dictionary:    1. Prevent aliasing in case `na_values` was defined in
a broader scope.  2. Respect column indices as keys when doing NA
conversions.    Closes #14203.

Author: gfyoung <gfyoung17@gmail.com>

Closes #14751 from gfyoung/csv-na-values-patching and squashes the following commits:

cac422c [gfyoung] BUG: Respect column indices for dict-like na_values
1439c27 [gfyoung] BUG: Prevent aliasing of dict na_values

jorisvandenbossche added a commit to jorisvandenbossche/pandas that referenced this issue Dec 24, 2016

BUG: Patch read_csv NA values behaviour
Patches the following behaviour when `na_values` is passed in as a
dictionary:    1. Prevent aliasing in case `na_values` was defined in
a broader scope.  2. Respect column indices as keys when doing NA
conversions.    Closes #14203.

Author: gfyoung <gfyoung17@gmail.com>

Closes #14751 from gfyoung/csv-na-values-patching and squashes the following commits:

cac422c [gfyoung] BUG: Respect column indices for dict-like na_values
1439c27 [gfyoung] BUG: Prevent aliasing of dict na_values

(cherry picked from commit dd8cba2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment