Skip to content

Commit 13ec509

Browse files
Backport PR #45237: DOC: Improve doc summaries in series.rst (#45268)
Co-authored-by: Matthew Roeschke <[email protected]>
1 parent eefe2f4 commit 13ec509

File tree

9 files changed

+24
-20
lines changed

9 files changed

+24
-20
lines changed

pandas/core/arrays/categorical.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ def remove_unused_categories(self, inplace=no_default):
13601360

13611361
def map(self, mapper):
13621362
"""
1363-
Map categories using input correspondence (dict, Series, or function).
1363+
Map categories using an input mapping or function.
13641364
13651365
Maps the categories to new categories. If the mapping correspondence is
13661366
one-to-one the result is a :class:`~pandas.Categorical` which has the

pandas/core/arrays/datetimes.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def dtype(self) -> np.dtype | DatetimeTZDtype: # type: ignore[override]
570570
@property
571571
def tz(self) -> tzinfo | None:
572572
"""
573-
Return timezone, if any.
573+
Return the timezone.
574574
575575
Returns
576576
-------
@@ -1278,7 +1278,9 @@ def day_name(self, locale=None):
12781278
@property
12791279
def time(self) -> npt.NDArray[np.object_]:
12801280
"""
1281-
Returns numpy array of datetime.time. The time part of the Timestamps.
1281+
Returns numpy array of :class:`datetime.time` objects.
1282+
1283+
The time part of the Timestamps.
12821284
"""
12831285
# If the Timestamps have a timezone that is not UTC,
12841286
# convert them into their i8 representation while
@@ -1290,16 +1292,20 @@ def time(self) -> npt.NDArray[np.object_]:
12901292
@property
12911293
def timetz(self) -> npt.NDArray[np.object_]:
12921294
"""
1293-
Returns numpy array of datetime.time also containing timezone
1294-
information. The time part of the Timestamps.
1295+
Returns numpy array of :class:`datetime.time` objects with timezone
1296+
information.
1297+
1298+
The time part of the Timestamps.
12951299
"""
12961300
return ints_to_pydatetime(self.asi8, self.tz, box="time")
12971301

12981302
@property
12991303
def date(self) -> npt.NDArray[np.object_]:
13001304
"""
1301-
Returns numpy array of python datetime.date objects (namely, the date
1302-
part of Timestamps without timezone information).
1305+
Returns numpy array of python :class:`datetime.date` objects.
1306+
1307+
Namely, the date part of Timestamps without time and
1308+
timezone information.
13031309
"""
13041310
# If the Timestamps have a timezone that is not UTC,
13051311
# convert them into their i8 representation while

pandas/core/arrays/sparse/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class SparseArray(OpsMixin, PandasObject, ExtensionArray):
298298
repeats of the scalar value instead.
299299
300300
fill_value : scalar, optional
301-
Elements in `data` that are `fill_value` are not stored in the
301+
Elements in data that are ``fill_value`` are not stored in the
302302
SparseArray. For memory savings, this should be the most common value
303303
in `data`. By default, `fill_value` depends on the dtype of `data`:
304304
@@ -1265,7 +1265,7 @@ def astype(self, dtype: AstypeArg | None = None, copy: bool = True):
12651265

12661266
def map(self: SparseArrayT, mapper) -> SparseArrayT:
12671267
"""
1268-
Map categories using input correspondence (dict, Series, or function).
1268+
Map categories using an input mapping or function.
12691269
12701270
Parameters
12711271
----------

pandas/core/groupby/groupby.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,8 @@ class providing the base-class of operations.
375375
the results together.
376376
%(klass)s.groupby.aggregate : Aggregate using one or more
377377
operations over the specified axis.
378-
%(klass)s.transform : Call ``func`` on self producing a %(klass)s with
379-
transformed values.
378+
%(klass)s.transform : Call ``func`` on self producing a %(klass)s with the
379+
same axis shape as self.
380380
381381
Notes
382382
-----

pandas/core/indexes/accessors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class DatetimeProperties(Properties):
193193

194194
def to_pydatetime(self) -> np.ndarray:
195195
"""
196-
Return the data as an array of native Python datetime objects.
196+
Return the data as an array of :class:`datetime.datetime` objects.
197197
198198
Timezone information is retained if present.
199199
@@ -333,7 +333,7 @@ class TimedeltaProperties(Properties):
333333

334334
def to_pytimedelta(self) -> np.ndarray:
335335
"""
336-
Return an array of native `datetime.timedelta` objects.
336+
Return an array of native :class:`datetime.timedelta` objects.
337337
338338
Python's standard `datetime` library uses a different representation
339339
timedelta's. This method converts a Series of pandas Timedeltas

pandas/core/indexes/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6029,7 +6029,7 @@ def groupby(self, values) -> PrettyDict[Hashable, np.ndarray]:
60296029

60306030
def map(self, mapper, na_action=None):
60316031
"""
6032-
Map values using input correspondence (a dict, Series, or function).
6032+
Map values using an input mapping or function.
60336033
60346034
Parameters
60356035
----------

pandas/core/indexes/category.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def take_nd(self, *args, **kwargs):
506506

507507
def map(self, mapper):
508508
"""
509-
Map values using input correspondence (a dict, Series, or function).
509+
Map values using input an input mapping or function.
510510
511511
Maps the values (their categories, not the codes) of the index to new
512512
categories. If the mapping correspondence is one-to-one the result is a

pandas/core/series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4145,7 +4145,7 @@ def unstack(self, level=-1, fill_value=None) -> DataFrame:
41454145

41464146
def map(self, arg, na_action=None) -> Series:
41474147
"""
4148-
Map values of Series according to input correspondence.
4148+
Map values of Series according to an input mapping or function.
41494149
41504150
Used for substituting each value in a Series with another value,
41514151
that may be derived from a function, a ``dict`` or

pandas/core/shared_docs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
will be used to determine the groups (the Series' values are first
9797
aligned; see ``.align()`` method). If a list or ndarray of length
9898
equal to the selected axis is passed (see the `groupby user guide
99-
<https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#splitting-an-object-into-groups>`),
99+
<https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#splitting-an-object-into-groups>`_),
100100
the values are used as-is to determine the groups. A label or list
101101
of labels may be passed to group by the columns in ``self``.
102102
Notice that a tuple is interpreted as a (single) key.
@@ -267,9 +267,7 @@
267267
_shared_docs[
268268
"transform"
269269
] = """
270-
Call ``func`` on self producing a {klass} with transformed values.
271-
272-
Produced {klass} will have same axis length as self.
270+
Call ``func`` on self producing a {klass} with the same axis shape as self.
273271
274272
Parameters
275273
----------

0 commit comments

Comments
 (0)