Python | Pandas PeriodIndex.to_timestamp Last Updated : 06 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 PeriodIndex.to_timestamp() function casts the given PeriodIndex object to DatetimeIndex object. Syntax : PeriodIndex.to_timestamp(freq=None, how='start') Parameters : freq : string or DateOffset, default ‘D’ for week or longer, ‘S’ how : {‘s’, ‘e’, ‘start’, ‘end’} Return : DatetimeIndex Example #1: Use PeriodIndex.to_timestamp() function to cast the given PeriodIndex object to DatetimeIndex. Python3 # importing pandas as pd import pandas as pd # Create the PeriodIndex object pidx = pd.PeriodIndex(start = '2004-11-11 02:45:21 ', end = '2021-5-21 8:45:29', freq = 'Y') # Print the PeriodIndex object print(pidx) Output : Now we will use the PeriodIndex.to_timestamp() function to cast the given PeriodIndex object to DatetimeIndex object. Python3 # cast to DatetimeIndex object pidx.to_timestamp() ] Output : As we can see in the output, the PeriodIndex.to_timestamp() function has returned a DatetimeIndex object. Example #2: Use PeriodIndex.to_timestamp() function to cast the given PeriodIndex object to DatetimeIndex. Python3 # importing pandas as pd import pandas as pd # Create the PeriodIndex object pidx = pd.PeriodIndex(start = '2016-10-12 11:12:02', end = '2016-10-12 11:19:12', freq = 'T') # Print the PeriodIndex object print(pidx) Output : Now we will use the PeriodIndex.to_timestamp() function to cast the given PeriodIndex object to DatetimeIndex object. Python3 # cast to DatetimeIndex object pidx.to_timestamp() ] Output : As we can see in the output, the PeriodIndex.to_timestamp() function has returned a DatetimeIndex object. Comment More infoAdvertise with us Next Article Python | Pandas Period.to_timestamp S Shubham__Ranjan Follow Improve Article Tags : Technical Scripter Python Python-pandas Pandas periodIndex Practice Tags : python Similar Reads Python | Pandas Period.to_timestamp 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 Period.to_timestamp() function return the Timestamp representation of the Perio 2 min read Python | Pandas Timestamp.to_period 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.to_period() function return a period object for which the given Times 2 min read Python | Pandas PeriodIndex.start_time 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 PeriodIndex.start_time attribute return a DatetimeIndex object containing the s 2 min read Python | Pandas PeriodIndex.strftime 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 PeriodIndex.strftime() function return an array of formatted strings specified 2 min read Python | Pandas PeriodIndex.end_time 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 PeriodIndex.end_time attribute returns an Index object. The Index contains the 2 min read Python | Pandas Timestamp.to_pydatetime 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.to_pydatetime() function convert a Timestamp object to a native Pytho 2 min read Like