Skip to content

BUG from_csv na_filter=False not working with index #18143

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

Closed
jebob opened this issue Nov 6, 2017 · 1 comment
Closed

BUG from_csv na_filter=False not working with index #18143

jebob opened this issue Nov 6, 2017 · 1 comment
Labels
Duplicate Report Duplicate issue or pull request

Comments

@jebob
Copy link
Contributor

jebob commented Nov 6, 2017

Code Sample, a copy-pastable example if possible

pd.DataFrame({"col1": ["NA"], "col2": ["NA"]}).to_csv("test.csv", index=False, header=None)

output = pd.read_csv("test.csv", header=None, names=["iso2", "region"], index_col="iso2", na_filter=False)
print(output)

Problem description

Reading the file, "test.csv", with na_filter set to false, causes a "NA" to be read as a nan when that column is converted into the index. Reading the file without index_col and then converting works.

Expected Output

The index should contain the string "NA", not the float nan.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.2.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.20.3
pytest: 3.2.3
pip: 9.0.1
setuptools: 36.5.0
Cython: None
numpy: 1.13.1
scipy: 1.0.0b1
xarray: None
IPython: None
sphinx: None
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.0.2
openpyxl: 2.4.8
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.6.0
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
pandas_gbq: None
pandas_datareader: None

@TomAugspurger
Copy link
Contributor

Looks like a duplicate of #5239. #18127 is fixing it, and will be merged shortly.

@TomAugspurger TomAugspurger added the Duplicate Report Duplicate issue or pull request label Nov 6, 2017
@TomAugspurger TomAugspurger added this to the No action milestone Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants