To return proleptic Gregorian ordinal, use the timestamp.toordinal() method. At first, import the required libraries −
import pandas as pd
Create the timestamp object in Pandas
timestamp = pd.Timestamp(2021, 9, 18, 11, 50, 20, 33)
Return proleptic Gregorian ordinal. Example: January 1 of year 1 is day 1
timestamp.toordinal()
Example
Following is the code
import pandas as pd # set the timestamp object in Pandas timestamp = pd.Timestamp(2021, 9, 18, 11, 50, 20, 33) # display the Timestamp print("Timestamp...\n", timestamp) # Return proleptic Gregorian ordinal. # Example: January 1 of year 1 is day 1. print("\nGregorian ordinal...\n", timestamp.toordinal())
Output
This will produce the following code
Timestamp... 2021-09-18 11:50:20.000033 Gregorian ordinal... 738051