-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
Read_csv should raise error on bad dtypes #3795
Comments
@jreback suggesting should return a frame with floats converted to str (which pandas will then cvt to object)? or convert to object (which still leaves them as floats)... |
op wanted a string dtype..... the answer is to do:
I am just suggesting a) if we see a dtype== so this would just avoid the however I think there is also a case of
|
It has to be a valid type (at least) ... I like the idea of special casing str. With regards to last point I guess conceivably you may know the things you're passing are datetime64[ns] already... ? |
yes...I could see something like:
being equivalent to
for consistency then you could just construct a dtype dict (rather than having to separate out the date fields) (also showing the conversion of the 'string-like' dtypes |
i think special casing str is probably the way 2 go. what happens if someone passes @jreback what's the reason again for not using numpy's string type? i've sort of dogmatically accepted |
hmmm...the first case should probably be an error
|
fyi...looking at this closer, passing 'str' as the dtype actually works, but since the width of the string is 0 it does weird stuff....so that's the case to handle e.g. |
OPs code from http://stackoverflow.com/questions/16988526/pandas-reading-csv-as-string-type
Add: auto conversion from a passed
str
ornp.string_
tonp.object
might be okActually I get something different on dev:
The text was updated successfully, but these errors were encountered: