Python | Pandas Timestamp.fromordinal Last Updated : 14 Jan, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Timestamp.fromordinal() function return a Timestamp object when passed an ordinal, the function translate and convert it to a ts object. By definition there cannot be any tz info on the ordinal itself. Syntax :Timestamp.fromordinal() Parameters : ordinal : date corresponding to a proleptic Gregorian ordinal freq : Offset which Timestamp will have tz : Time zone for time which Timestamp will have Return : Timestamp Example #1: Use Timestamp.fromordinal() function to translate the given Timestamp object based on the passed ordinal value. Python3 # importing pandas as pd import pandas as pd # Create the Timestamp object ts = pd.Timestamp(year = 2011, month = 11, day = 21, hour = 10, second = 49, tz = 'US/Central') # Print the Timestamp object print(ts) Output : Now we will use the Timestamp.fromordinal() function to convert the given Timestamp object. Python3 # convert the given Timestamp object # based on the passed ordinal value ts.fromordinal(ordinal = 733829) Output : As we can see in the output, the Timestamp.fromordinal() function has returned a new Timestamp object based on the passed ordinal value. Example #2: Use Timestamp.fromordinal() function to translate the given Timestamp object based on the passed ordinal value. Also set the timezone. Python3 # importing pandas as pd import pandas as pd # Create the Timestamp object ts = pd.Timestamp(year = 2009, month = 5, day = 31, hour = 4, second = 49, tz = 'Europe/Berlin') # Print the Timestamp object print(ts) Output : Now we will use the Timestamp.fromordinal() function to convert the given Timestamp object. Python3 # convert the given Timestamp object # based on the passed ordinal value ts.fromordinal(ordinal = 634816, tz = 'Asia / Calcutta') Output : As we can see in the output, the Timestamp.fromordinal() function has returned a new Timestamp object based on the passed ordinal value. The function has also set the timezone for the returned Timestamp object. Comment More infoAdvertise with us Next Article Python | Pandas Timestamp.date S Shubham__Ranjan Follow Improve Article Tags : Technical Scripter Python Python-pandas Python Pandas-Timestamp Practice Tags : python Similar Reads Python | Pandas Timestamp.day Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Timestamp.day attribute return the value of the day in the given Timestamp obje 2 min read Python | Pandas Timestamp.month Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Timestamp.month attribute is used to find the month value in the given Timestam 2 min read Python | Pandas Timestamp.fromtimestamp Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Timestamp.fromtimestamp() function return a Timestamp object when passed an int 2 min read Python | Pandas Timestamp.date Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Timestamp.date() function return a datetime object with same year, month and da 2 min read Python | Pandas Timestamp.minute Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Timestamp.minute attribute return the minute value in the given Timestamp objec 2 min read Python | Pandas Timestamp.hour Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Timestamp.hour attribute return the value of the hour for the given Timestamp o 2 min read Like