Repository: pandas-dev/pandas

Issue:
DOC: Fix docstring quotes in pandas.PeriodIndex
I am trying to work on fixing the docstring errors GL01 and GL02. The `validate_docstrings.py` gave a lot of them so I picked `pandas.PeriodIndex`:
```
pandas.PeriodIndex.day: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.day: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.dayofweek: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.dayofweek: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.dayofyear: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.dayofyear: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.days_in_month: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.days_in_month: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.daysinmonth: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.daysinmonth: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.hour: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.hour: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.minute: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.minute: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.month: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.month: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.quarter: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.quarter: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.second: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.second: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.week: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.week: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.weekday: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.weekday: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.weekofyear: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.weekofyear: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
pandas.PeriodIndex.year: Docstring text (summary) should start in the line immediately after the opening quotes (not in the same line, or leaving a blank line in between)
pandas.PeriodIndex.year: Closing quotes should be placed in the line after the last text in the docstring (do not close the quotes in the same line as the text, or leave a blank line between the last text and the quotes)
```

However I need some help navigating to the related docstrings for each of these attributes. I thought I could find the `PeriodIndex` class at `pandas.core.indexes.period` which I did but I can't find any of the attributes (so the docstrings) in that file.

I am fairly new to contributing to Pandas so maybe I am making a dumb mistake or looking at the wrong place so I would appreciate some guidance.

Thanks!














Discussion:
Those attributes are inherited via PeriodArray, which is in pandas.core.arrays.period
Hey @jbrockmendel  -- I think I found it. So when I did this it fixed the `days_in_month`, is this the right way to do it:
```
days_in_month = _field_accessor("days_in_month", 
                                11, 
                                """
                                The number of days in the month
                                """
)
```
My guess is it will want a period at the end of the docstring, but that looks about right.
@jbrockmendel -- Ok so should I do a PR for `pandas.PeriodIndex`? The `validate_docstrings.py` doesn't give any errors now.
That'd be great, thanks.
And I will continue on other GL01 and GL02 errors in this same manner. Thanks!

Resolving patch:
diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py
--- 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 = """
diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py
--- 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
 


Test patch: