Skip to content

Commit e758a19

Browse files
authored
DOC: Fixing EX01 - Added examples (#54084)
* Examples backfill & attrs * Examples df.backfill, attr, style
1 parent dbb19b9 commit e758a19

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

ci/code_checks.sh

-3
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,11 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
158158
pandas.api.extensions.ExtensionArray.shape \
159159
pandas.api.extensions.ExtensionArray.tolist \
160160
pandas.DataFrame.columns \
161-
pandas.DataFrame.backfill \
162161
pandas.DataFrame.ffill \
163162
pandas.DataFrame.pad \
164163
pandas.DataFrame.swapaxes \
165-
pandas.DataFrame.attrs \
166164
pandas.DataFrame.plot \
167165
pandas.DataFrame.to_gbq \
168-
pandas.DataFrame.style \
169166
pandas.DataFrame.__dataframe__
170167
RET=$(($RET + $?)) ; echo $MSG "DONE"
171168

pandas/core/frame.py

+8
Original file line numberDiff line numberDiff line change
@@ -1297,6 +1297,14 @@ def style(self) -> Styler:
12971297
--------
12981298
io.formats.style.Styler : Helps style a DataFrame or Series according to the
12991299
data with HTML and CSS.
1300+
1301+
Examples
1302+
--------
1303+
>>> df = pd.DataFrame({'A': [1, 2, 3]})
1304+
>>> df.style # doctest: +SKIP
1305+
1306+
Please see
1307+
`Table Visualization <../../user_guide/style.ipynb>`_ for more examples.
13001308
"""
13011309
from pandas.io.formats.style import Styler
13021310

pandas/core/generic.py

+13
Original file line numberDiff line numberDiff line change
@@ -367,10 +367,19 @@ def attrs(self) -> dict[Hashable, Any]:
367367
368368
Examples
369369
--------
370+
For Series:
371+
370372
>>> ser = pd.Series([1, 2, 3])
371373
>>> ser.attrs = {"A": [10, 20, 30]}
372374
>>> ser.attrs
373375
{'A': [10, 20, 30]}
376+
377+
For DataFrame:
378+
379+
>>> df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
380+
>>> df.attrs = {"A": [10, 20, 30]}
381+
>>> df.attrs
382+
{'A': [10, 20, 30]}
374383
"""
375384
if self._attrs is None:
376385
self._attrs = {}
@@ -7500,6 +7509,10 @@ def backfill(
75007509
-------
75017510
{klass} or None
75027511
Object with missing values filled or None if ``inplace=True``.
7512+
7513+
Examples
7514+
--------
7515+
Please see examples for :meth:`DataFrame.bfill`.
75037516
"""
75047517
warnings.warn(
75057518
"DataFrame.backfill/Series.backfill is deprecated. Use "

0 commit comments

Comments
 (0)