1

I have an epoch:

1625803200000

I'm then converting it to a readable format using:

df['date'] = pd.to_datetime(df['date'],unit='ms')

Which returns:

2021-07-09 04:00:00

The time isn't relevant, so I'm trying to remove it. When I do:

df['date'] = pd.to_datetime(df['date'][:-6],unit='ms')

It returns NaT

How do I only return the date?

It's inside a pandas data frame, not sure if that's relevant. Sorry for the noob question!

a7dc
  • 3,323
  • 7
  • 32
  • 50
  • 1
    With a regular Python `datetime` you can just call `date` on it, but the Pandas version requires you to go through some gyrations. See linked dupe. – Samwise Mar 19 '22 at 02:42
  • Thanks Sam the linked duped solved my issue – a7dc Mar 23 '22 at 16:31

0 Answers0