diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 45df480779ee7..c046d55d80b49 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -85,7 +85,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then MSG='Partially validate docstrings (EX01)' ; echo $MSG $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX01 --ignore_functions \ - pandas.Series.index \ pandas.Series.__iter__ \ pandas.Series.keys \ pandas.Series.item \ diff --git a/pandas/core/series.py b/pandas/core/series.py index c1997331ed06d..6551ba5b6761d 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -5745,7 +5745,46 @@ def to_period(self, freq: str | None = None, copy: bool | None = None) -> Series _info_axis_name: Literal["index"] = "index" index = properties.AxisProperty( - axis=0, doc="The index (axis labels) of the Series." + axis=0, + doc=""" + The index (axis labels) of the Series. + + The index of a Series is used to label and identify each element of the + underlying data. The index can be thought of as an immutable ordered set + (technically a multi-set, as it may contain duplicate labels), and is + used to index and align data in pandas. + + Returns + ------- + Index + The index labels of the Series. + + See Also + -------- + Series.reindex : Conform Series to new index. + Series.set_index : Set Series as DataFrame index. + Index : The base pandas index type. + + Notes + ----- + For more information on pandas indexing, see the `indexing user guide + `__. + + Examples + -------- + To create a Series with a custom index and view the index labels: + + >>> cities = ['Kolkata', 'Chicago', 'Toronto', 'Lisbon'] + >>> populations = [14.85, 2.71, 2.93, 0.51] + >>> city_series = pd.Series(populations, index=cities) + >>> city_series.index + Index(['Kolkata', 'Chicago', 'Toronto', 'Lisbon'], dtype='object') + + To change the index labels of an existing Series: + >>> city_series.index = ['KOL', 'CHI', 'TOR', 'LIS'] + >>> city_series.index + Index(['KOL', 'CHI', 'TOR', 'LIS'], dtype='object') + """, ) # ----------------------------------------------------------------------