Skip to content

Commit 37586ce

Browse files
Merge branch 'main' into np-doc-df-sum
2 parents 0acb69c + 51c547b commit 37586ce

File tree

6 files changed

+262
-16
lines changed

6 files changed

+262
-16
lines changed

ci/code_checks.sh

+2-11
Original file line numberDiff line numberDiff line change
@@ -78,18 +78,12 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7878
-i "pandas.DataFrame.std PR01,RT03,SA01" \
7979
-i "pandas.DataFrame.swaplevel SA01" \
8080
-i "pandas.DataFrame.to_markdown SA01" \
81-
-i "pandas.DataFrame.var PR01,RT03,SA01" \
8281
-i "pandas.Grouper PR02" \
8382
-i "pandas.Index PR07" \
8483
-i "pandas.Index.join PR07,RT03,SA01" \
85-
-i "pandas.Index.names GL08" \
8684
-i "pandas.Index.ravel PR01,RT03" \
8785
-i "pandas.Index.str PR01,SA01" \
8886
-i "pandas.Interval PR02" \
89-
-i "pandas.Interval.closed SA01" \
90-
-i "pandas.Interval.left SA01" \
91-
-i "pandas.Interval.mid SA01" \
92-
-i "pandas.Interval.right SA01" \
9387
-i "pandas.IntervalIndex.closed SA01" \
9488
-i "pandas.IntervalIndex.contains RT03" \
9589
-i "pandas.IntervalIndex.get_loc PR07,RT03,SA01" \
@@ -206,9 +200,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
206200
-i "pandas.Series.list.flatten SA01" \
207201
-i "pandas.Series.list.len SA01" \
208202
-i "pandas.Series.lt PR07,SA01" \
209-
-i "pandas.Series.max RT03" \
210203
-i "pandas.Series.mean RT03,SA01" \
211-
-i "pandas.Series.median RT03,SA01" \
212204
-i "pandas.Series.min RT03" \
213205
-i "pandas.Series.mod PR07" \
214206
-i "pandas.Series.mode SA01" \
@@ -302,7 +294,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
302294
-i "pandas.TimedeltaIndex.nanoseconds SA01" \
303295
-i "pandas.TimedeltaIndex.seconds SA01" \
304296
-i "pandas.TimedeltaIndex.to_pytimedelta RT03,SA01" \
305-
-i "pandas.Timestamp PR07,SA01" \
306297
-i "pandas.Timestamp.as_unit SA01" \
307298
-i "pandas.Timestamp.asm8 SA01" \
308299
-i "pandas.Timestamp.astimezone SA01" \
@@ -321,9 +312,9 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
321312
-i "pandas.Timestamp.isocalendar SA01" \
322313
-i "pandas.Timestamp.isoformat SA01" \
323314
-i "pandas.Timestamp.isoweekday SA01" \
324-
-i "pandas.Timestamp.max PR02,PR07,SA01" \
315+
-i "pandas.Timestamp.max PR02" \
325316
-i "pandas.Timestamp.microsecond GL08" \
326-
-i "pandas.Timestamp.min PR02,PR07,SA01" \
317+
-i "pandas.Timestamp.min PR02" \
327318
-i "pandas.Timestamp.minute GL08" \
328319
-i "pandas.Timestamp.month GL08" \
329320
-i "pandas.Timestamp.month_name SA01" \

pandas/_libs/interval.pyx

+25
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ cdef class IntervalMixin:
167167
"""
168168
Return the midpoint of the Interval.
169169
170+
See Also
171+
--------
172+
Interval.left : Return the left bound for the interval.
173+
Interval.right : Return the right bound for the interval.
174+
Interval.length : Return the length of the interval.
175+
170176
Examples
171177
--------
172178
>>> iv = pd.Interval(0, 5)
@@ -377,6 +383,12 @@ cdef class Interval(IntervalMixin):
377383
"""
378384
Left bound for the interval.
379385
386+
See Also
387+
--------
388+
Interval.right : Return the right bound for the interval.
389+
numpy.ndarray.left : A similar method in numpy for obtaining
390+
the left endpoint(s) of intervals.
391+
380392
Examples
381393
--------
382394
>>> interval = pd.Interval(left=1, right=2, closed='left')
@@ -390,6 +402,12 @@ cdef class Interval(IntervalMixin):
390402
"""
391403
Right bound for the interval.
392404
405+
See Also
406+
--------
407+
Interval.left : Return the left bound for the interval.
408+
numpy.ndarray.right : A similar method in numpy for obtaining
409+
the right endpoint(s) of intervals.
410+
393411
Examples
394412
--------
395413
>>> interval = pd.Interval(left=1, right=2, closed='left')
@@ -405,6 +423,13 @@ cdef class Interval(IntervalMixin):
405423
406424
Either ``left``, ``right``, ``both`` or ``neither``.
407425
426+
See Also
427+
--------
428+
Interval.closed_left : Check if the interval is closed on the left side.
429+
Interval.closed_right : Check if the interval is closed on the right side.
430+
Interval.open_left : Check if the interval is open on the left side.
431+
Interval.open_right : Check if the interval is open on the right side.
432+
408433
Examples
409434
--------
410435
>>> interval = pd.Interval(left=1, right=2, closed='left')

pandas/_libs/tslibs/timestamps.pyx

+21-2
Original file line numberDiff line numberDiff line change
@@ -1297,10 +1297,24 @@ class Timestamp(_Timestamp):
12971297
----------
12981298
ts_input : datetime-like, str, int, float
12991299
Value to be converted to Timestamp.
1300-
year, month, day : int
1301-
hour, minute, second, microsecond : int, optional, default 0
1300+
year : int
1301+
Value of year.
1302+
month : int
1303+
Value of month.
1304+
day : int
1305+
Value of day.
1306+
hour : int, optional, default 0
1307+
Value of hour.
1308+
minute : int, optional, default 0
1309+
Value of minute.
1310+
second : int, optional, default 0
1311+
Value of second.
1312+
microsecond : int, optional, default 0
1313+
Value of microsecond.
13021314
tzinfo : datetime.tzinfo, optional, default None
1315+
Timezone info.
13031316
nanosecond : int, optional, default 0
1317+
Value of nanosecond.
13041318
tz : str, pytz.timezone, dateutil.tz.tzfile or None
13051319
Time zone for time which Timestamp will have.
13061320
unit : str
@@ -1316,6 +1330,11 @@ class Timestamp(_Timestamp):
13161330
datetime-like corresponds to the first (0) or the second time (1)
13171331
the wall clock hits the ambiguous time.
13181332
1333+
See Also
1334+
--------
1335+
Timedelta : Represents a duration, the difference between two dates or times.
1336+
datetime.datetime : Python datetime.datetime object.
1337+
13191338
Notes
13201339
-----
13211340
There are essentially three calling conventions for the constructor. The

pandas/core/frame.py

+69-1
Original file line numberDiff line numberDiff line change
@@ -12146,7 +12146,6 @@ def var(
1214612146
) -> Series | Any: ...
1214712147

1214812148
@deprecate_nonkeyword_arguments(version="3.0", allowed_args=["self"], name="var")
12149-
@doc(make_doc("var", ndim=2))
1215012149
def var(
1215112150
self,
1215212151
axis: Axis | None = 0,
@@ -12155,6 +12154,75 @@ def var(
1215512154
numeric_only: bool = False,
1215612155
**kwargs,
1215712156
) -> Series | Any:
12157+
"""
12158+
Return unbiased variance over requested axis.
12159+
12160+
Normalized by N-1 by default. This can be changed using the ddof argument.
12161+
12162+
Parameters
12163+
----------
12164+
axis : {index (0), columns (1)}
12165+
For `Series` this parameter is unused and defaults to 0.
12166+
12167+
.. warning::
12168+
12169+
The behavior of DataFrame.var with ``axis=None`` is deprecated,
12170+
in a future version this will reduce over both axes and return a scalar
12171+
To retain the old behavior, pass axis=0 (or do not pass axis).
12172+
12173+
skipna : bool, default True
12174+
Exclude NA/null values. If an entire row/column is NA, the result
12175+
will be NA.
12176+
ddof : int, default 1
12177+
Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
12178+
where N represents the number of elements.
12179+
numeric_only : bool, default False
12180+
Include only float, int, boolean columns. Not implemented for Series.
12181+
**kwargs :
12182+
Additional keywords passed.
12183+
12184+
Returns
12185+
-------
12186+
Series or scalaer
12187+
Unbiased variance over requested axis.
12188+
12189+
See Also
12190+
--------
12191+
numpy.var : Equivalent function in NumPy.
12192+
Series.var : Return unbiased variance over Series values.
12193+
Series.std : Return standard deviation over Series values.
12194+
DataFrame.std : Return standard deviation of the values over
12195+
the requested axis.
12196+
12197+
Examples
12198+
--------
12199+
>>> df = pd.DataFrame(
12200+
... {
12201+
... "person_id": [0, 1, 2, 3],
12202+
... "age": [21, 25, 62, 43],
12203+
... "height": [1.61, 1.87, 1.49, 2.01],
12204+
... }
12205+
... ).set_index("person_id")
12206+
>>> df
12207+
age height
12208+
person_id
12209+
0 21 1.61
12210+
1 25 1.87
12211+
2 62 1.49
12212+
3 43 2.01
12213+
12214+
>>> df.var()
12215+
age 352.916667
12216+
height 0.056367
12217+
dtype: float64
12218+
12219+
Alternatively, ``ddof=0`` can be set to normalize by N instead of N-1:
12220+
12221+
>>> df.var(ddof=0)
12222+
age 264.687500
12223+
height 0.042275
12224+
dtype: float64
12225+
"""
1215812226
result = super().var(
1215912227
axis=axis, skipna=skipna, ddof=ddof, numeric_only=numeric_only, **kwargs
1216012228
)

pandas/core/indexes/base.py

+17
Original file line numberDiff line numberDiff line change
@@ -1799,6 +1799,23 @@ def _get_default_index_names(
17991799
return names
18001800

18011801
def _get_names(self) -> FrozenList:
1802+
"""
1803+
Get names on index.
1804+
1805+
See Also
1806+
--------
1807+
Index.name : Return Index or MultiIndex name.
1808+
1809+
Examples
1810+
--------
1811+
>>> idx = pd.Index([1, 2, 3], name="x")
1812+
>>> idx.names
1813+
FrozenList(['x'])
1814+
1815+
>>> idx = s = pd.Index([1, 2, 3], name=("x", "y"))
1816+
>>> idx.names
1817+
FrozenList([('x', 'y')])
1818+
"""
18021819
return FrozenList((self.name,))
18031820

18041821
def _set_names(self, values, *, level=None) -> None:

0 commit comments

Comments
 (0)