Python | Pandas Timestamp.minute

Python Methods and Functions

The Pandas Timestamp.minute attribute returns the minute in this Timestamp object. If the minute has not been set, 0 is returned.

Syntax: Timestamp.minute

Parameters: None

Return: minute

Example # 1: Use the Timestamp.minute attribute to find the minute in a given Timestamp object.

# import pandas as pd

import pandas as pd

 
# Create Timestamp object

ts = pd.Timestamp ( 2016 , 1 , 1 , 12 , 25 , 16 , 28 )

 
# Print Timestamp object

print (ts)

Output:

We will now use the Timestamp.minute attribute to display the minute in the ts object.

# find the minute value
ts.minute

Output:

As we can see from the output, the Timestamp.minute attribute returned 25, indicating that the minute in the ts object is set to 25.

Example # 2: Use the Timestamp.minute attribute to find the minute in a given Timestamp object.

# import pandas as pd

import pandas as pd

 
# Create Timestamp object

ts = pd.Timestamp (year = 2009 , month = 5 , day = 31 , hour = 4 ,

microsecond = 15 , tz = 'Europe / Berlin' )

 
# Print the Timestamp object

print (ts)

Output:

We will now use the Timestamp.minute attribute to display the minute in the ts object.

 

# find the minute
ts.minute

Output:

As we can see from the output, the Timestamp.minute attribute returned 0 because the minute was not set for the given ts object, so the output is 0.





Get Solution for free from DataCamp guru