Get Minutes from timestamp (date) in pandas python

dt.minute  is the inbuilt method to get minutes from timestamp (date) in Pandas Python.  Let’s see how to

  • Get the minutes from timestamp (date) in pandas python

First lets create the dataframe


import pandas as pd
import numpy as np
import datetime

date1 = pd.Series(pd.date_range('2012-1-1 11:20:00', periods=7, freq='min'))
df = pd.DataFrame(dict(date_given=date1))
print(df)

so the resultant dataframe will be

Get Minutes from timestamp in pandas python 1

 

minute function gets minute value of the timestamp


df['minute_of_timestamp'] = df['date_given'].dt.minute
print(df)

so the resultant dataframe will be

Get Minutes from timestamp in pandas python 2

 

Get Minutes from timestamp (date) in pandas python                                                                                                                Get Minutes from timestamp (date) in pandas python