Skip to content

Commit c9017d9

Browse files
authored
DOC: fix EX02 errors in docstrings (#51578)
1 parent 887d2c4 commit c9017d9

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

ci/code_checks.sh

-3
Original file line numberDiff line numberDiff line change
@@ -565,14 +565,11 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
565565
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX02 --ignore_functions \
566566
pandas.DataFrame.plot.line \
567567
pandas.Series.plot.line \
568-
pandas.api.types.infer_dtype \
569568
pandas.api.types.is_datetime64_any_dtype \
570569
pandas.api.types.is_datetime64_ns_dtype \
571570
pandas.api.types.is_datetime64tz_dtype \
572571
pandas.api.types.is_integer_dtype \
573-
pandas.api.types.is_sparse \
574572
pandas.api.types.is_string_dtype \
575-
pandas.api.types.is_unsigned_integer_dtype \
576573
pandas.plotting.andrews_curves \
577574
pandas.plotting.autocorrelation_plot \
578575
pandas.plotting.lag_plot \

pandas/_libs/lib.pyx

+3-1
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ def infer_dtype(value: object, skipna: bool = True) -> str:
14201420

14211421
Examples
14221422
--------
1423-
>>> import datetime
1423+
>>> from pandas.api.types import infer_dtype
14241424
>>> infer_dtype(['foo', 'bar'])
14251425
'string'
14261426

@@ -1445,6 +1445,7 @@ def infer_dtype(value: object, skipna: bool = True) -> str:
14451445
>>> infer_dtype(['a', 1])
14461446
'mixed-integer'
14471447

1448+
>>> from decimal import Decimal
14481449
>>> infer_dtype([Decimal(1), Decimal(2.0)])
14491450
'decimal'
14501451

@@ -1457,6 +1458,7 @@ def infer_dtype(value: object, skipna: bool = True) -> str:
14571458
>>> infer_dtype([pd.Timestamp('20130101')])
14581459
'datetime'
14591460

1461+
>>> import datetime
14601462
>>> infer_dtype([datetime.date(2013, 1, 1)])
14611463
'date'
14621464

pandas/core/dtypes/common.py

+2
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ def is_sparse(arr) -> bool:
207207
--------
208208
Returns `True` if the parameter is a 1-D pandas sparse array.
209209
210+
>>> from pandas.api.types import is_sparse
210211
>>> is_sparse(pd.arrays.SparseArray([0, 0, 1, 0]))
211212
True
212213
>>> is_sparse(pd.Series(pd.arrays.SparseArray([0, 0, 1, 0])))
@@ -785,6 +786,7 @@ def is_unsigned_integer_dtype(arr_or_dtype) -> bool:
785786
786787
Examples
787788
--------
789+
>>> from pandas.api.types import is_unsigned_integer_dtype
788790
>>> is_unsigned_integer_dtype(str)
789791
False
790792
>>> is_unsigned_integer_dtype(int) # signed

pandas/io/formats/style.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,9 @@ def concat(self, other: Styler) -> Styler:
330330
A common use case is adding totals rows, or otherwise, via methods calculated
331331
in ``DataFrame.agg``.
332332
333-
>>> df = pd.DataFrame([[4, 6], [1, 9], [3, 4], [5, 5], [9,6]],
334-
... columns=["Mike", "Jim"],
335-
... index=["Mon", "Tue", "Wed", "Thurs", "Fri"])
333+
>>> df = pd.DataFrame([[4, 6], [1, 9], [3, 4], [5, 5], [9, 6]],
334+
... columns=["Mike", "Jim"],
335+
... index=["Mon", "Tue", "Wed", "Thurs", "Fri"])
336336
>>> styler = df.style.concat(df.agg(["sum"]).style) # doctest: +SKIP
337337
338338
.. figure:: ../../_static/style/footer_simple.png
@@ -358,7 +358,7 @@ def concat(self, other: Styler) -> Styler:
358358
to extend the index in ``other``, with placeholder levels.
359359
360360
>>> df = pd.DataFrame([[1], [2]],
361-
... index=pd.MultiIndex.from_product([[0], [1, 2]]))
361+
... index=pd.MultiIndex.from_product([[0], [1, 2]]))
362362
>>> descriptors = df.agg(["sum"])
363363
>>> descriptors.index = pd.MultiIndex.from_product([[""], descriptors.index])
364364
>>> df.style.concat(descriptors.style) # doctest: +SKIP

0 commit comments

Comments
 (0)