Skip to content

TypeError: dtype '<class 'datetime.datetime'>' not understood #25730

@dickreuter

Description

@dickreuter
df
  valuation_date
0     2018-06-08
1     2018-06-11
2     2018-06-12
3     2018-06-13
4     2018-06-14
5     2018-06-15
type(valuation_dates_df)
Out[16]: pandas.core.frame.DataFrame


type(valuation_dates_df['valuation_date'])
Out[15]: pandas.core.series.Series

To reproduce the error:

dict= {'valuation_date': {0: Timestamp('2018-06-08 00:00:00'),
  1: Timestamp('2018-06-11 00:00:00'),
  2: Timestamp('2018-06-12 00:00:00'),
  3: Timestamp('2018-06-13 00:00:00'),
  4: Timestamp('2018-06-14 00:00:00'),
  5: Timestamp('2018-06-15 00:00:00')}}

pd.DataFrame.from_records(dict)['valuation_date'].astype(datetime.datetime)

valuation_dates_df['valuation_date'].astype(datetime.datetime)
  File "C:\git\mre_x\_tcp\work\win-na-x64-release\py3\mre_venv3\lib\site-packages\pandas\core\dtypes\common.py", line 2029, in pandas_dtype
    raise TypeError("dtype '{}' not understood".format(dtype))
TypeError: dtype '<class 'datetime.datetime'>' not understood

The issue occurs with pandas 0.24.1 and did not occur in 0.23.4.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions