Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

communitycreator
pandas

What is the pandas.Period.day attribute in pandas?

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Overview

The Period.day attribute in pandas is used to obtain the particular day of the month that a Period object falls on. A Period object here represents a period of time.

Syntax

The Period.day attribute has the following syntax:

Period.day
Syntax for the Period.day attribute

Parameter value

Because Period.day is an attribute, it does not take any parameter values.

Return value

The Period.day attribute returns an int that indicates the day of the month for that period.

Example

# A code to illustrate the Period.day attribute in Pandas

# importing the pandas library
import pandas as pd

# creating a period
a = pd.Period("2022-05-01")

print(a.day)
Implementing the Period.day attribute

Explanation

  • Line 4: We import the pandas library.
  • Line 7: We create a Period object a.
  • Line 9: We obtain the day from the Period object using the attribute Period.day, and print the value to the console.

RELATED TAGS

communitycreator
pandas

CONTRIBUTOR

Onyejiaku Theophilus Chidalu

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring