Python | Панды Timestamp.days_in_month
Python - отличный язык для анализа данных, в первую очередь из-за фантастической экосистемы пакетов Python, ориентированных на данные. Pandas - один из таких пакетов, который значительно упрощает импорт и анализ данных.
Pandas Timestamp.days_in_month attribute return the number of days in the month for the given date in the Timestamp object.
Syntax : Timestamp.days_in_month
Parameters : None
Return : number of days in month
Example #1: Use Timestamp.days_in_month attribute to find out the number of days in the given Timestamp object.
# importing pandas as pdimport pandas as pd # Create the Timestamp objectts = pd.Timestamp(2017, 2, 15, 12) # Print the Timestamp objectprint(ts) |
Выход :

Now we will use the Timestamp.days_in_month attribute to find out the number of days in the given Timestamp object.
# return the number of days in monthts.days_in_month |
Выход :

As we can see in the output, the Timestamp.days_in_month attribute has returned 28 indicating that there are 28 days in the month of the given Timestamp object.
Example #2: Use Timestamp.days_in_month attribute to find out the number of days in the given Timestamp object.
Выход :

Now we will use the Timestamp.days_in_month attribute to find out the number of days in the given Timestamp object.
# return the number of days in monthts.days_in_month |
Выход :

As we can see in the output, the Timestamp.days_in_month attribute has returned 31 indicating that there are 31 days in the month of the given Timestamp object.
Внимание компьютерщик! Укрепите свои основы с помощью базового курса программирования Python и изучите основы.
Для начала подготовьтесь к собеседованию. Расширьте свои концепции структур данных с помощью курса Python DS. А чтобы начать свое путешествие по машинному обучению, присоединяйтесь к курсу Машинное обучение - базовый уровень.