Skip to content

pandas.PeriodIndex and pandas.DateTimeIndex docstring quotes fix #27716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 83 additions & 13 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1414,17 +1414,69 @@ def date(self):

return tslib.ints_to_pydatetime(timestamps, box="date")

year = _field_accessor("year", "Y", "The year of the datetime.")
month = _field_accessor("month", "M", "The month as January=1, December=12. ")
day = _field_accessor("day", "D", "The days of the datetime.")
hour = _field_accessor("hour", "h", "The hours of the datetime.")
minute = _field_accessor("minute", "m", "The minutes of the datetime.")
second = _field_accessor("second", "s", "The seconds of the datetime.")
year = _field_accessor(
"year",
"Y",
"""
The year of the datetime.
""",
)
month = _field_accessor(
"month",
"M",
"""
The month as January=1, December=12.
""",
)
day = _field_accessor(
"day",
"D",
"""
The month as January=1, December=12.
""",
)
hour = _field_accessor(
"hour",
"h",
"""
The hours of the datetime.
""",
)
minute = _field_accessor(
"minute",
"m",
"""
The minutes of the datetime.
""",
)
second = _field_accessor(
"second",
"s",
"""
The seconds of the datetime.
""",
)
microsecond = _field_accessor(
"microsecond", "us", "The microseconds of the datetime."
"microsecond",
"us",
"""
The microseconds of the datetime.
""",
)
nanosecond = _field_accessor(
"nanosecond",
"ns",
"""
The nanoseconds of the datetime.
""",
)
weekofyear = _field_accessor(
"weekofyear",
"woy",
"""
The week ordinal of the year.
""",
)
nanosecond = _field_accessor("nanosecond", "ns", "The nanoseconds of the datetime.")
weekofyear = _field_accessor("weekofyear", "woy", "The week ordinal of the year.")
week = weekofyear
_dayofweek_doc = """
The day of the week with Monday=0, Sunday=6.
Expand Down Expand Up @@ -1466,13 +1518,31 @@ def date(self):
weekday_name = _field_accessor(
"weekday_name",
"weekday_name",
"The name of day in a week (ex: Friday)\n\n.. deprecated:: 0.23.0",
"""
The name of day in a week (ex: Friday)\n\n.. deprecated:: 0.23.0
""",
)

dayofyear = _field_accessor("dayofyear", "doy", "The ordinal day of the year.")
quarter = _field_accessor("quarter", "q", "The quarter of the date.")
dayofyear = _field_accessor(
"dayofyear",
"doy",
"""
The ordinal day of the year.
""",
)
quarter = _field_accessor(
"quarter",
"q",
"""
The quarter of the date.
""",
)
days_in_month = _field_accessor(
"days_in_month", "dim", "The number of days in the month."
"days_in_month",
"dim",
"""
The number of days in the month.
""",
)
daysinmonth = days_in_month
_is_month_doc = """
Expand Down
82 changes: 71 additions & 11 deletions pandas/core/arrays/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,25 +342,85 @@ def __array__(self, dtype=None):
# --------------------------------------------------------------------
# Vectorized analogues of Period properties

year = _field_accessor("year", 0, "The year of the period")
month = _field_accessor("month", 3, "The month as January=1, December=12")
day = _field_accessor("day", 4, "The days of the period")
hour = _field_accessor("hour", 5, "The hour of the period")
minute = _field_accessor("minute", 6, "The minute of the period")
second = _field_accessor("second", 7, "The second of the period")
weekofyear = _field_accessor("week", 8, "The week ordinal of the year")
year = _field_accessor(
"year",
0,
"""
The year of the period.
""",
)
month = _field_accessor(
"month",
3,
"""
The month as January=1, December=12.
""",
)
day = _field_accessor(
"day",
4,
"""
The days of the period.
""",
)
hour = _field_accessor(
"hour",
5,
"""
The hour of the period.
""",
)
minute = _field_accessor(
"minute",
6,
"""
The minute of the period.
""",
)
second = _field_accessor(
"second",
7,
"""
The second of the period.
""",
)
weekofyear = _field_accessor(
"week",
8,
"""
The week ordinal of the year.
""",
)
week = weekofyear
dayofweek = _field_accessor(
"dayofweek", 10, "The day of the week with Monday=0, Sunday=6"
"dayofweek",
10,
"""
The day of the week with Monday=0, Sunday=6.
""",
)
weekday = dayofweek
dayofyear = day_of_year = _field_accessor(
"dayofyear", 9, "The ordinal day of the year"
"dayofyear",
9,
"""
The ordinal day of the year.
""",
)
quarter = _field_accessor(
"quarter",
2,
"""
The quarter of the date.
""",
)
quarter = _field_accessor("quarter", 2, "The quarter of the date")
qyear = _field_accessor("qyear", 1)
days_in_month = _field_accessor(
"days_in_month", 11, "The number of days in the month"
"days_in_month",
11,
"""
The number of days in the month.
""",
)
daysinmonth = days_in_month

Expand Down