Pandas `.to_pydatetime()` not working inside a DataFrame
问题 I have strings like '03-21-2019' that I want to convert to the native Python datetime object: that is, of the datetime.datetime type. The conversion is easy enough through pandas : import pandas as pd import datetime as dt date_str = '03-21-2019' pd_Timestamp = pd.to_datetime(date_str) py_datetime_object = pd_Timestamp.to_pydatetime() print(type(py_datetime_object)) with the result <class 'datetime.datetime'> This is precisely what I want, since I want to compute timedelta 's by subtracting