-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsDuplicate ReportDuplicate issue or pull requestDuplicate issue or pull requestIO CSVread_csv, to_csvread_csv, to_csvMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Description
Code Sample, a copy-pastable example if possible
from pandas.compat import StringIO import pandas as pd t1 = """float 1 """ t2 = """float NaN """ for t in t1, t2: df = pd.read_csv(StringIO(t), dtype={'float': 'str'}) print(type(df['float'][0]))Problem description
Even when explicitly specifying dtype above, read_csv still converts values in the float column to a float when the string is "NaN". This behavior appears to be limited to "NaN" as it doesn't happen for regular numbers. Still, I unexpectedly ran across a "NaN" string in my application so it's blocking me.
Metadata
Metadata
Assignees
Labels
BugDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsDuplicate ReportDuplicate issue or pull requestDuplicate issue or pull requestIO CSVread_csv, to_csvread_csv, to_csvMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatenp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate