Reputation: 1297
I ask question right after trying: this.
Have dates:
type(md):
pandas._libs.tslib.Timestamp
But it look different from the
Timestamp('2016-03-03 00:00:00')
,
namely:
Timestamp('2018-02-02 23:59:59+0000', tz='UTC')
So, how can i just ignore tzinfo
and convert it to a datetime.datetime
Upvotes: 0
Views: 934
Reputation: 1314
You can change the time-zone info, i.e., set it to default which is None
, and then convert it to Python's datetime
object as follows:
ts = pd.Timestamp('2018-02-02 23:59:59+0000', tz='UTC')
ts.tz_convert(None)
# returns Timestamp('2018-02-02 23:59:59')
ts.tz_convert(None).to_pydatetime()
# returns datetime.datetime(2018, 2, 2, 23, 59, 59)
Upvotes: 1