Home > Back-end >  How to return individual dates from a date-time series in Python?
How to return individual dates from a date-time series in Python?

Time:08-10

I have a datetime column in a data frame. From that column i want to return every single day. In that df, I have 14 days and each day has so many values with even miliseconds.

So I want a output like [2022-07-18, 2022-07-19,………………]

CodePudding user response:

You can standardize the format with .dt.date. If it has not yet been converted into datetime, then use:

df['Dates'] = pd.to_datetime(df['Dates'],infer_datetime_format=True).dt.date

CodePudding user response:

Did you read the official documentation of pandas about this topic? https://pandas.pydata.org/docs/reference/api/pandas.to_datetime.html

  • Related