0

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

Ladenkov Vladislav
  • 1,247
  • 2
  • 21
  • 45

1 Answers1

1

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)
jeschwar
  • 1,286
  • 7
  • 10