Skip to content

Commit fa3dfdb

Browse files
authored
DOC: improve IO & General Functions API reference (#45208)
1 parent eef0222 commit fa3dfdb

File tree

10 files changed

+29
-16
lines changed

10 files changed

+29
-16
lines changed

doc/source/reference/general_functions.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ Top-level missing data
3737
notna
3838
notnull
3939

40-
Top-level conversions
41-
~~~~~~~~~~~~~~~~~~~~~
40+
Top-level dealing with numeric data
41+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4242
.. autosummary::
4343
:toctree: api/
4444

4545
to_numeric
4646

47-
Top-level dealing with datetimelike
48-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47+
Top-level dealing with datetimelike data
48+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4949
.. autosummary::
5050
:toctree: api/
5151

@@ -57,8 +57,8 @@ Top-level dealing with datetimelike
5757
timedelta_range
5858
infer_freq
5959

60-
Top-level dealing with intervals
61-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60+
Top-level dealing with Interval data
61+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6262
.. autosummary::
6363
:toctree: api/
6464

doc/source/reference/io.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ HDFStore: PyTables (HDF5)
135135

136136
.. warning::
137137

138-
One can store a subclass of ``DataFrame`` or ``Series`` to HDF5,
138+
One can store a subclass of :class:`DataFrame` or :class:`Series` to HDF5,
139139
but the type of the subclass is lost upon storing.
140140

141141
Feather

pandas/core/algorithms.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,9 @@ def _check_object_for_strings(values: np.ndarray) -> str:
335335

336336
def unique(values):
337337
"""
338-
Hash table-based unique. Uniques are returned in order
339-
of appearance. This does NOT sort.
338+
Return unique values based on a hash table.
339+
340+
Uniques are returned in order of appearance. This does NOT sort.
340341
341342
Significantly faster than numpy.unique for long enough sequences.
342343
Includes NA values.

pandas/core/base.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,9 @@ def __iter__(self):
763763
@cache_readonly
764764
def hasnans(self) -> bool:
765765
"""
766-
Return if I have any nans; enables various perf speedups.
766+
Return True if there are any NaNs.
767+
768+
Enables various performance speedups.
767769
"""
768770
return bool(isna(self).any())
769771

pandas/core/generic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3182,7 +3182,7 @@ def to_latex(
31823182
position=None,
31833183
):
31843184
r"""
3185-
Render object to a LaTeX tabular, longtable, or nested table/tabular.
3185+
Render object to a LaTeX tabular, longtable, or nested table.
31863186
31873187
Requires ``\usepackage{{booktabs}}``. The output can be copy/pasted
31883188
into a main LaTeX document or read from an external file
@@ -5433,7 +5433,7 @@ def pipe(
54335433
**kwargs,
54345434
) -> T:
54355435
r"""
5436-
Apply func(self, \*args, \*\*kwargs).
5436+
Apply chainable functions that expect Series or DataFrames.
54375437
54385438
Parameters
54395439
----------

pandas/core/indexes/base.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -2646,7 +2646,9 @@ def _isnan(self) -> npt.NDArray[np.bool_]:
26462646
@cache_readonly
26472647
def hasnans(self) -> bool:
26482648
"""
2649-
Return if I have any nans; enables various perf speedups.
2649+
Return True if there are any NaNs.
2650+
2651+
Enables various performance speedups.
26502652
"""
26512653
if self._can_hold_na:
26522654
return bool(self._isnan.any())

pandas/core/reshape/melt.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ def wide_to_long(
257257
df: DataFrame, stubnames, i, j, sep: str = "", suffix: str = r"\d+"
258258
) -> DataFrame:
259259
r"""
260-
Wide panel to long format. Less flexible but more user-friendly than melt.
260+
Unpivot a DataFrame from wide to long format.
261+
262+
Less flexible but more user-friendly than melt.
261263
262264
With stubnames ['A', 'B'], this function expects to find one or more
263265
group of columns with format

pandas/core/reshape/merge.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def merge_ordered(
195195
how: str = "outer",
196196
) -> DataFrame:
197197
"""
198-
Perform merge with optional filling/interpolation.
198+
Perform a merge for ordered data with optional filling/interpolation.
199199
200200
Designed for ordered data like time series data. Optionally
201201
perform group-wise merge (see examples).
@@ -340,7 +340,7 @@ def merge_asof(
340340
direction: str = "backward",
341341
) -> DataFrame:
342342
"""
343-
Perform an asof merge.
343+
Perform a merge by key distance.
344344
345345
This is similar to a left-join except that we match on nearest
346346
key rather than equal keys. Both DataFrames must be sorted by the key.

pandas/io/stata.py

+3
Original file line numberDiff line numberDiff line change
@@ -2605,6 +2605,9 @@ def _encode_strings(self) -> None:
26052605
self.data[col] = encoded
26062606

26072607
def write_file(self) -> None:
2608+
"""
2609+
Export DataFrame object to Stata dta format.
2610+
"""
26082611
with get_handle(
26092612
self._fname,
26102613
"wb",

pandas/util/_tester.py

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99

1010
def test(extra_args=None):
11+
"""
12+
Run the pandas test suite using pytest.
13+
"""
1114
try:
1215
import pytest
1316
except ImportError as err:

0 commit comments

Comments
 (0)