From feaaee7e6eaa07e777bfbe716eb0cac63a7a288f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dea=20Mar=C3=ADa=20L=C3=A9on?= Date: Tue, 11 Jul 2023 19:07:27 +0200 Subject: [PATCH 1/2] Examples backfill & attrs --- pandas/core/generic.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 7735e55fdd042..42cd74a0ca781 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -367,10 +367,19 @@ def attrs(self) -> dict[Hashable, Any]: Examples -------- + For Series: + >>> ser = pd.Series([1, 2, 3]) >>> ser.attrs = {"A": [10, 20, 30]} >>> ser.attrs {'A': [10, 20, 30]} + + For DataFrame: + + >>> df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]}) + >>> df.attrs = {"A": [10, 20, 30]} + >>> df.attrs + {'A': [10, 20, 30]} """ if self._attrs is None: self._attrs = {} @@ -7500,6 +7509,10 @@ def backfill( ------- {klass} or None Object with missing values filled or None if ``inplace=True``. + + Examples + -------- + Please see examples for :meth:`DataFrame.bfill`. """ warnings.warn( "DataFrame.backfill/Series.backfill is deprecated. Use " From 872426700478a3ff55015847015327066dc0cb11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dea=20Mar=C3=ADa=20L=C3=A9on?= Date: Tue, 11 Jul 2023 19:50:45 +0200 Subject: [PATCH 2/2] Examples df.backfill, attr, style --- ci/code_checks.sh | 3 --- pandas/core/frame.py | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 756096a7fe345..fd256f2ff7db0 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -158,14 +158,11 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.api.extensions.ExtensionArray.shape \ pandas.api.extensions.ExtensionArray.tolist \ pandas.DataFrame.columns \ - pandas.DataFrame.backfill \ pandas.DataFrame.ffill \ pandas.DataFrame.pad \ pandas.DataFrame.swapaxes \ - pandas.DataFrame.attrs \ pandas.DataFrame.plot \ pandas.DataFrame.to_gbq \ - pandas.DataFrame.style \ pandas.DataFrame.__dataframe__ RET=$(($RET + $?)) ; echo $MSG "DONE" diff --git a/pandas/core/frame.py b/pandas/core/frame.py index c469c99940f7e..feae3bb517c22 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1297,6 +1297,14 @@ def style(self) -> Styler: -------- io.formats.style.Styler : Helps style a DataFrame or Series according to the data with HTML and CSS. + + Examples + -------- + >>> df = pd.DataFrame({'A': [1, 2, 3]}) + >>> df.style # doctest: +SKIP + + Please see + `Table Visualization <../../user_guide/style.ipynb>`_ for more examples. """ from pandas.io.formats.style import Styler