Python | Период панд. Месяц
Python - отличный язык для анализа данных, в первую очередь из-за фантастической экосистемы пакетов Python, ориентированных на данные. Pandas - один из таких пакетов, который значительно упрощает импорт и анализ данных.
Pandas Period.month attribute return an integer value. The returned value represents the value of month in the given period object. January being 1 to December being 12.
Syntax : Period.month
Parameters : None
Return : month
Example #1: Use Period.month attribute to find the value of month in the given Period object.
# importing pandas as pdimport pandas as pd # Create the Period objectprd = pd.Period(freq ="S", year = 2000, month = 2, day = 21, hour = 8, minute = 21) # Print the Period objectprint(prd) |
Выход :

Now we will use the Period.month attribute to find out value of month in prd object.
# return value of monthprd.month |
Выход :

As we can see in the output, the Period.month attribute has returned 2 indicating that the given period object has ‘February’ as a month.
Example #2: Use Period.month attribute to find the value of month in the given Period object.
Выход :

Now we will use the Period.month attribute to find out value of month in prd object.
# return value of monthprd.month |
Выход :

As we can see in the output, the Period.month attribute has returned 10 indicating that the given period object has ‘October’ as a month.
Внимание компьютерщик! Укрепите свои основы с помощью базового курса программирования Python и изучите основы.
Для начала подготовьтесь к собеседованию. Расширьте свои концепции структур данных с помощью курса Python DS. А чтобы начать свое путешествие по машинному обучению, присоединяйтесь к курсу Машинное обучение - базовый уровень.