Python | Pandas PeriodIndex.strftime 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.strftime() function return an array of formatted strings specified by date_format, which supports the same string format as the python standard library. Syntax : PeriodIndex.strftime(date_format) Parameters : date_format : date format string (e.g. ā%Y-%m-%dā) Return : ndarray of formatted strings Example #1: Use PeriodIndex.strftime() function to print the given PeriodIndex object in the specified date_format. 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.strftime() function to return the each period element in ('%b. %d, %Y was a %A') format. Python3 # return the PeriodIndex in specified format pidx.strftime('% b. % d, % Y was a % A') ] Output : As we can see in the output, the PeriodIndex.strftime() function has returned an Index object containing each element of the given PeriodIndex object in the specified format. Ā Example #2: Use PeriodIndex.strftime() function to print the given PeriodIndex object in the specified date_format. Python3 # importing pandas as pd import pandas as pd # Create the PeriodIndex object pidx = pd.PeriodIndex(start = '2016-10-12 11:12:02', end = '2020-04-12 11:32:12', freq = 'Q') # Print the PeriodIndex object print(pidx) Output : Now we will use the PeriodIndex.strftime() function to return the each period element in ('%b-%Y') format. Python3 # return the PeriodIndex in specified format pidx.strftime('% b-% Y') ] Output : As we can see in the output, the PeriodIndex.strftime() function has returned an Index object containing each element of the given PeriodIndex object in the specified format. Comment More infoAdvertise with us Next Article Python | Pandas Period.start_time S Shubham__Ranjan Follow Improve Article Tags : Technical Scripter Python Python-pandas Pandas periodIndex Practice Tags : python Similar Reads 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 Period.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 Period.strftime() function returns the string representation of the Period, dep 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 PeriodIndex.quarter 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.quarter attribute return an Index object containing the quarter of 2 min read Python | Pandas Period.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 Period.start_time attribute returns a Timestamp object containing the start tim 2 min read Python | Pandas PeriodIndex.second 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.second attribute return an Index object containing the second value 2 min read Like