We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
http://stackoverflow.com/questions/16157939/pandas-read-csv-fills-empty-values-with-string-nan/16158762#16158762
The convert_objects(convert_dates='force') should really just to to_datetime()....
In [1]: In [1]: data = """ ...: ...: value date id ...: ...: 0 2 2013-3-1 a ...: ...: 1 3 2013-3-1 b ...: ...: 2 4 2013-3-1 c ...: ...: 3 5 nan d ...: ...: 4 6 2013-3-1 d ...: ...: """ In [2]: In [15]: df = pd.read_csv(StringIO(data[1:]),index_col=0,sep='\s+') In [3]: df.dtypes Out[3]: ...: float64 value float64 date object id object dtype: object In [4]: In [24]: pd.to_datetime(df['date']) Out[4]: ...: 2013-03-01 00:00:00 ...: 2013-03-01 00:00:00 ...: 2013-03-01 00:00:00 ...: NaT ...: 2013-03-01 00:00:00 ...: NaT Name: date, dtype: datetime64[ns] In [5]: df['date'].convert_objects(convert_dates=True) Out[5]: ...: 2013-3-1 ...: 2013-3-1 ...: 2013-3-1 ...: NaN ...: 2013-3-1 ...: None Name: date, dtype: object
The text was updated successfully, but these errors were encountered:
closed by #3516
Sorry, something went wrong.
jreback
No branches or pull requests
http://stackoverflow.com/questions/16157939/pandas-read-csv-fills-empty-values-with-string-nan/16158762#16158762
The convert_objects(convert_dates='force') should really just to
to_datetime()....
The text was updated successfully, but these errors were encountered: