From fa09384a31ad63c7156cc32b452918c113adda5c Mon Sep 17 00:00:00 2001 From: Arda Kosar Date: Fri, 2 Aug 2019 12:06:23 -0400 Subject: [PATCH 1/3] pandas.PeriodIndex docstring quotes fix --- pandas/core/arrays/period.py | 82 +++++++++++++++++++++++++++++++----- 1 file changed, 71 insertions(+), 11 deletions(-) diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py index c290391278def..4ef76285c12b2 100644 --- a/pandas/core/arrays/period.py +++ b/pandas/core/arrays/period.py @@ -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 From 9d97d85bf1a111f4d2cbb3a597e5314705fadcf2 Mon Sep 17 00:00:00 2001 From: Arda Kosar Date: Fri, 2 Aug 2019 12:28:46 -0400 Subject: [PATCH 2/3] pandas.DateTimeIndex docstring quotes fix --- pandas/core/arrays/datetimes.py | 96 ++++++++++++++++++++++++++++----- 1 file changed, 83 insertions(+), 13 deletions(-) diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index 2e086c8ce8c34..94848bbbbd013 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -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. @@ -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 = """ From 0609b7100886298fb8415904dcff3ac3e3eefba5 Mon Sep 17 00:00:00 2001 From: Arda Kosar Date: Fri, 2 Aug 2019 13:19:22 -0400 Subject: [PATCH 3/3] ran black against the modified files --- pandas/core/arrays/datetimes.py | 24 ++++++++++++------------ pandas/core/arrays/period.py | 22 +++++++++++----------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index 94848bbbbd013..6a4ca0ab4147a 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -1419,63 +1419,63 @@ def date(self): "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. - """ + """, ) 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 = """ @@ -1528,21 +1528,21 @@ def date(self): "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. - """ + """, ) daysinmonth = days_in_month _is_month_doc = """ diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py index 4ef76285c12b2..91dd853e78c77 100644 --- a/pandas/core/arrays/period.py +++ b/pandas/core/arrays/period.py @@ -347,49 +347,49 @@ def __array__(self, dtype=None): 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( @@ -397,7 +397,7 @@ def __array__(self, dtype=None): 10, """ The day of the week with Monday=0, Sunday=6. - """ + """, ) weekday = dayofweek dayofyear = day_of_year = _field_accessor( @@ -405,14 +405,14 @@ def __array__(self, dtype=None): 9, """ The ordinal day of the year. - """ + """, ) quarter = _field_accessor( "quarter", 2, """ The quarter of the date. - """ + """, ) qyear = _field_accessor("qyear", 1) days_in_month = _field_accessor( @@ -420,7 +420,7 @@ def __array__(self, dtype=None): 11, """ The number of days in the month. - """ + """, ) daysinmonth = days_in_month