Skip to content

Commit 23b6115

Browse files
Scowley4datapythonista
authored andcommitted
DOC: Fix section headers in docstrings (#26301)
1 parent 7bfbd81 commit 23b6115

28 files changed

+114
-119
lines changed

pandas/core/arrays/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,8 +1059,8 @@ def _create_method(cls, op, coerce_to_dtype=True):
10591059
`op` cannot be stored in the ExtensionArray. The dtype of the
10601060
ndarray uses NumPy's normal inference rules.
10611061
1062-
Example
1063-
-------
1062+
Examples
1063+
--------
10641064
Given an ExtensionArray subclass called MyExtensionArray, use
10651065
10661066
>>> __add__ = cls._create_method(operator.add)

pandas/core/arrays/categorical.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2140,23 +2140,18 @@ def _reverse_indexer(self):
21402140
-------
21412141
dict of categories -> indexers
21422142
2143-
Example
2144-
-------
2145-
In [1]: c = pd.Categorical(list('aabca'))
2146-
2147-
In [2]: c
2148-
Out[2]:
2143+
Examples
2144+
--------
2145+
>>> c = pd.Categorical(list('aabca'))
2146+
>>> c
21492147
[a, a, b, c, a]
21502148
Categories (3, object): [a, b, c]
2151-
2152-
In [3]: c.categories
2153-
Out[3]: Index(['a', 'b', 'c'], dtype='object')
2154-
2155-
In [4]: c.codes
2156-
Out[4]: array([0, 0, 1, 2, 0], dtype=int8)
2157-
2158-
In [5]: c._reverse_indexer()
2159-
Out[5]: {'a': array([0, 1, 4]), 'b': array([2]), 'c': array([3])}
2149+
>>> c.categories
2150+
Index(['a', 'b', 'c'], dtype='object')
2151+
>>> c.codes
2152+
array([0, 0, 1, 2, 0], dtype=int8)
2153+
>>> c._reverse_indexer()
2154+
{'a': array([0, 1, 4]), 'b': array([2]), 'c': array([3])}
21602155
21612156
"""
21622157
categories = self.categories

pandas/core/arrays/datetimes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ def __iter__(self):
586586
Return an iterator over the boxed values
587587
588588
Yields
589-
-------
589+
------
590590
tstamp : Timestamp
591591
"""
592592

pandas/core/arrays/interval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
qcut : Bin values into equal-sized Intervals based on rank or sample quantiles.
9494
9595
Notes
96-
------
96+
-----
9797
See the `user guide
9898
<http://pandas.pydata.org/pandas-docs/stable/advanced.html#intervalindex>`_
9999
for more.

pandas/core/arrays/sparse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@ def from_coo(cls, A, dense_index=False):
19551955
s : SparseSeries
19561956
19571957
Examples
1958-
---------
1958+
--------
19591959
>>> from scipy import sparse
19601960
>>> A = sparse.coo_matrix(([3.0, 1.0, 2.0], ([1, 0, 0], [0, 2, 3])),
19611961
shape=(3, 4))

pandas/core/dtypes/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def is_dtype_equal(source, target):
763763
target : The second dtype to compare
764764
765765
Returns
766-
----------
766+
-------
767767
boolean
768768
Whether or not the two dtypes are equal.
769769
@@ -804,7 +804,7 @@ def is_dtype_union_equal(source, target):
804804
target : The second dtype to compare
805805
806806
Returns
807-
----------
807+
-------
808808
boolean
809809
Whether or not the two dtypes are equal.
810810

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7250,7 +7250,7 @@ def corrwith(self, other, axis=0, drop=False, method='pearson'):
72507250
Pairwise correlations.
72517251
72527252
See Also
7253-
-------
7253+
--------
72547254
DataFrame.corr
72557255
"""
72567256
axis = self._get_axis_number(axis)

pandas/core/generic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10327,11 +10327,11 @@ def transform(self, func, *args, **kwargs):
1032710327
Return index for %(position)s non-NA/null value.
1032810328
1032910329
Returns
10330-
--------
10330+
-------
1033110331
scalar : type of index
1033210332
1033310333
Notes
10334-
--------
10334+
-----
1033510335
If all elements are non-NA/null, returns None.
1033610336
Also returns None for empty %(klass)s.
1033710337
"""

pandas/core/groupby/groupby.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,13 +799,13 @@ def _try_cast(self, result, obj, numeric_only=False):
799799

800800
def _transform_should_cast(self, func_nm):
801801
"""
802-
Parameters:
803-
-----------
802+
Parameters
803+
----------
804804
func_nm: str
805805
The name of the aggregation function being performed
806806
807-
Returns:
808-
--------
807+
Returns
808+
-------
809809
bool
810810
Whether transform should attempt to cast the result of aggregation
811811
"""

pandas/core/indexes/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class Index(IndexOpsMixin, PandasObject):
183183
When True, attempt to create a MultiIndex if possible
184184
185185
See Also
186-
---------
186+
--------
187187
RangeIndex : Index implementing a monotonic integer range.
188188
CategoricalIndex : Index of :class:`Categorical` s.
189189
MultiIndex : A multi-level, or hierarchical, Index.
@@ -2649,7 +2649,7 @@ def _convert_can_do_setop(self, other):
26492649
loc : int if unique index, slice if monotonic index, else mask
26502650
26512651
Examples
2652-
---------
2652+
--------
26532653
>>> unique_index = pd.Index(list('abc'))
26542654
>>> unique_index.get_loc('b')
26552655
1
@@ -4699,7 +4699,7 @@ def slice_indexer(self, start=None, end=None, step=None, kind=None):
46994699
This function assumes that the data is sorted, so use at your own peril
47004700
47014701
Examples
4702-
---------
4702+
--------
47034703
This is a method on all index types. For example you can do:
47044704
47054705
>>> idx = pd.Index(list('abcd'))
@@ -4902,7 +4902,7 @@ def slice_locs(self, start=None, end=None, step=None, kind=None):
49024902
This method only works if the index is monotonic or unique.
49034903
49044904
Examples
4905-
---------
4905+
--------
49064906
>>> idx = pd.Index(list('abcd'))
49074907
>>> idx.slice_locs(start='b', end='c')
49084908
(1, 3)

0 commit comments

Comments
 (0)