Repository: pandas-dev/pandas (python)

Issue:
DOC: fix docstring validation errors for `pandas.Timestamp`
follow up on issues #56804 and #58063
pandas has a script for validating docstrings:

https://github.com/pandas-dev/pandas/blob/0cdc6a48302ba1592b8825868de403ff9b0ea2a5/ci/code_checks.sh#L206-L244

Currently, some methods fail docstring validation check.
The task here is:
* take 2-4 methods
* run: `scripts/validate_docstrings.py <method-name>`
*  fix the docstrings according to whatever error is reported
* remove those methods from `code_checks.sh` script
* commit, push, open pull request

Example:
```
scripts/validate_docstrings.py pandas.Timestamp.tz_localize
```
pandas.Timestamp.tz_localize fails with the  SA01  error
```
################################################################################
################################## Validation ##################################
################################################################################

1 Errors found for `pandas.Timestamp.tz_localize`:
        SA01    See Also section not found
```

Please don't comment `take` as multiple people can work on this issue. You also don't need to ask for permission to work on this, just comment on which methods are you going to work.

If you're new contributor, please check the [contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)


Pull request description:
DOC: Added docstrings to min, max, and reso
Closes #59458

Added docstrings to `min`, `max`, and `resolution` for class `Timestamp`. Used same approach as seen in PR #61119

- [x] closes #59458 (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Patch:
diff --git a/ci/code_checks.sh b/ci/code_checks.sh
index 2c32eb4f0c..a0d23aa047 100755
--- a/ci/code_checks.sh
+++ b/ci/code_checks.sh
@@ -72,9 +72,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
         -i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
         -i "pandas.Period.freq GL08" \
         -i "pandas.Period.ordinal GL08" \
-        -i "pandas.Timestamp.max PR02" \
-        -i "pandas.Timestamp.min PR02" \
-        -i "pandas.Timestamp.resolution PR02" \
         -i "pandas.core.groupby.DataFrameGroupBy.plot PR02" \
         -i "pandas.core.groupby.SeriesGroupBy.plot PR02" \
         -i "pandas.core.resample.Resampler.quantile PR01,PR07" \
diff --git a/doc/source/whatsnew/v3.0.0.rst b/doc/source/whatsnew/v3.0.0.rst
index e6fafc8b1b..29be9a7341 100644
--- a/doc/source/whatsnew/v3.0.0.rst
+++ b/doc/source/whatsnew/v3.0.0.rst
@@ -773,6 +773,7 @@ Groupby/resample/rolling
 - Bug in :meth:`.DataFrameGroupBy.quantile` when ``interpolation="nearest"`` is inconsistent with :meth:`DataFrame.quantile` (:issue:`47942`)
 - Bug in :meth:`.Resampler.interpolate` on a :class:`DataFrame` with non-uniform sampling and/or indices not aligning with the resulting resampled index would result in wrong interpolation (:issue:`21351`)
 - Bug in :meth:`DataFrame.ewm` and :meth:`Series.ewm` when passed ``times`` and aggregation functions other than mean (:issue:`51695`)
+- Bug in :meth:`DataFrame.resample` and :meth:`Series.resample` were not keeping the index name when the index had :class:`ArrowDtype` timestamp dtype (:issue:`61222`)
 - Bug in :meth:`DataFrame.resample` changing index type to :class:`MultiIndex` when the dataframe is empty and using an upsample method (:issue:`55572`)
 - Bug in :meth:`DataFrameGroupBy.agg` that raises ``AttributeError`` when there is dictionary input and duplicated columns, instead of returning a DataFrame with the aggregation of all duplicate columns. (:issue:`55041`)
 - Bug in :meth:`DataFrameGroupBy.apply` and :meth:`SeriesGroupBy.apply` for empty data frame with ``group_keys=False`` still creating output index using group keys. (:issue:`60471`)
diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx
index 23197b9a55..390267db82 100644
--- a/pandas/_libs/tslibs/timestamps.pyx
+++ b/pandas/_libs/tslibs/timestamps.pyx
@@ -200,8 +200,9 @@ class MinMaxReso:
 
     See also: timedeltas.MinMaxReso
     """
-    def __init__(self, name):
+    def __init__(self, name, docstring):
         self._name = name
+        self.__doc__ = docstring
 
     def __get__(self, obj, type=None):
         cls = Timestamp
@@ -216,11 +217,15 @@ class MinMaxReso:
 
         if obj is None:
             # i.e. this is on the class, default to nanos
-            return cls(val)
+            result = cls(val)
         elif self._name == "resolution":
-            return Timedelta._from_value_and_reso(val, obj._creso)
+            result = Timedelta._from_value_and_reso(val, obj._creso)
         else:
-            return Timestamp._from_value_and_reso(val, obj._creso, tz=None)
+            result = Timestamp._from_value_and_reso(val, obj._creso, tz=None)
+
+        result.__doc__ = self.__doc__
+
+        return result
 
     def __set__(self, obj, value):
         raise AttributeError(f"{self._name} is not settable.")
@@ -235,9 +240,74 @@ cdef class _Timestamp(ABCTimestamp):
     dayofweek = _Timestamp.day_of_week
     dayofyear = _Timestamp.day_of_year
 
-    min = MinMaxReso("min")
-    max = MinMaxReso("max")
-    resolution = MinMaxReso("resolution")  # GH#21336, GH#21365
+    _docstring_min = """
+    Returns the minimum bound possible for Timestamp.
+
+    This property provides access to the smallest possible value that
+    can be represented by a Timestamp object.
+
+    Returns
+    -------
+    Timestamp
+
+    See Also
+    --------
+    Timestamp.max: Returns the maximum bound possible for Timestamp.
+    Timestamp.resolution: Returns the smallest possible difference between
+        non-equal Timestamp objects.
+
+    Examples
+    --------
+    >>> pd.Timestamp.min
+    Timestamp('1677-09-21 00:12:43.145224193')
+    """
+
+    _docstring_max = """
+    Returns the maximum bound possible for Timestamp.
+
+    This property provides access to the largest possible value that
+    can be represented by a Timestamp object.
+
+    Returns
+    -------
+    Timestamp
+
+    See Also
+    --------
+    Timestamp.min: Returns the minimum bound possible for Timestamp.
+    Timestamp.resolution: Returns the smallest possible difference between
+        non-equal Timestamp objects.
+
+    Examples
+    --------
+    >>> pd.Timestamp.max
+    Timestamp('2262-04-11 23:47:16.854775807')
+    """
+
+    _docstring_reso = """
+    Returns the smallest possible difference between non-equal Timestamp objects.
+
+    The resolution value is determined by the underlying representation of time
+    units and is equivalent to Timedelta(nanoseconds=1).
+
+    Returns
+    -------
+    Timedelta
+
+    See Also
+    --------
+    Timestamp.max: Returns the maximum bound possible for Timestamp.
+    Timestamp.min: Returns the minimum bound possible for Timestamp.
+
+    Examples
+    --------
+    >>> pd.Timestamp.resolution
+    Timedelta('0 days 00:00:00.000000001')
+    """
+
+    min = MinMaxReso("min", _docstring_min)
+    max = MinMaxReso("max", _docstring_max)
+    resolution = MinMaxReso("resolution", _docstring_reso)  # GH#21336, GH#21365
 
     @property
     def value(self) -> int:
diff --git a/pandas/core/resample.py b/pandas/core/resample.py
index 753f7fb6ce..08e3beef99 100644
--- a/pandas/core/resample.py
+++ b/pandas/core/resample.py
@@ -518,6 +518,7 @@ class Resampler(BaseGroupBy, PandasObject):
 
         if self._timegrouper._arrow_dtype is not None:
             result.index = result.index.astype(self._timegrouper._arrow_dtype)
+            result.index.name = self.obj.index.name
 
         return result
 
diff --git a/web/pandas/community/ecosystem.md b/web/pandas/community/ecosystem.md
index c6dddd5c2e..4863093387 100644
--- a/web/pandas/community/ecosystem.md
+++ b/web/pandas/community/ecosystem.md
@@ -655,7 +655,7 @@ Pandas provides an interface for defining
 The following libraries implement that interface to provide types not found in NumPy or pandas,
 which work well with pandas' data containers.
 
-### [awkward-pandas](https://awkward-pandas.readthedocs.io/)
+### [awkward-pandas](https://github.com/scikit-hep/awkward)
 
 Awkward-pandas provides an extension type for storing [Awkward
 Arrays](https://awkward-array.org/) inside pandas' Series and


Test patch:
diff --git a/pandas/tests/resample/test_datetime_index.py b/pandas/tests/resample/test_datetime_index.py
index 3a7fd548ca..f871c0bf02 100644
--- a/pandas/tests/resample/test_datetime_index.py
+++ b/pandas/tests/resample/test_datetime_index.py
@@ -2155,6 +2155,16 @@ def test_arrow_timestamp_resample(tz):
     tm.assert_series_equal(result, expected)
 
 
+@td.skip_if_no("pyarrow")
+def test_arrow_timestamp_resample_keep_index_name():
+    # https://github.com/pandas-dev/pandas/issues/61222
+    idx = Series(date_range("2020-01-01", periods=5), dtype="timestamp[ns][pyarrow]")
+    expected = Series(np.arange(5, dtype=np.float64), index=idx)
+    expected.index.name = "index_name"
+    result = expected.resample("1D").mean()
+    tm.assert_series_equal(result, expected)
+
+
 @pytest.mark.parametrize("freq", ["1A", "2A-MAR"])
 def test_resample_A_raises(freq):
     msg = f"Invalid frequency: {freq[1:]}"