Skip to content

read_csv example tricks parser dtypes #4692

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
hayd opened this issue Aug 27, 2013 · 2 comments
Closed

read_csv example tricks parser dtypes #4692

hayd opened this issue Aug 27, 2013 · 2 comments
Labels
Bug IO CSV read_csv, to_csv IO Data IO issues that don't fit into a more specific label

Comments

@hayd
Copy link
Contributor

hayd commented Aug 27, 2013

Poster has an example which tricks read_csv into thinking column a is a int, but then throws it lots of strings (and it then infers 1s as strings).

import pandas as pd
df = pd.DataFrame({'a':['1']*100000 + ['X']*100000 + ['1']*100000, 'b':['b']*300000})
df.to_csv('test', sep='\t', index=False, na_rep='NA')
df2 = pd.read_csv('test', sep='\t')
print df2['a'].unique()

http://stackoverflow.com/questions/18471859/pandas-read-csv-dtype-inference-issue

I think this is rather an edge case tbh. :)

@TomAugspurger
Copy link
Contributor

He (or someone) beat you to it. #4691

@hayd
Copy link
Contributor Author

hayd commented Aug 27, 2013

I did not do a very good search. #4691

@hayd hayd closed this as completed Aug 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO CSV read_csv, to_csv IO Data IO issues that don't fit into a more specific label
Projects
None yet
Development

No branches or pull requests

2 participants