0

Is it possible to calculate minute of the day, week, month and year and create a column in pandas DataFrame for them?

I'm already have Date column and formatted using pd.to_datetime(df["Date"])

Don Coder
  • 526
  • 5
  • 24
  • yes, you can access the `dt` element of the column get these values like so: `df.columns.dt.year`, `df.columns.dt.month` and so on. – quest Jun 30 '20 at 09:33
  • 3
    IIUC use [this](https://stackoverflow.com/questions/49298488/how-to-extract-hour-minute-and-second-from-series-filled-with-datetime-time-val) – jezrael Jun 30 '20 at 09:35
  • i know how to calculate using dt. I mean i can get day of the week and etc. I'm trying to calculate minute of the day, week, month – Don Coder Jun 30 '20 at 09:44
  • @DonCoder - Can you ad some sample data, [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve) ? – jezrael Jun 30 '20 at 10:06

0 Answers0