8989 infer_dtype_from_scalar ,
9090 invalidate_string_dtypes ,
9191 maybe_downcast_to_dtype ,
92+ maybe_unbox_numpy_scalar ,
9293)
9394from pandas .core .dtypes .common import (
9495 infer_dtype_from_object ,
@@ -3822,7 +3823,7 @@ def memory_usage(self, index: bool = True, deep: bool = False) -> Series:
38223823 many repeated values.
38233824
38243825 >>> df["object"].astype("category").memory_usage(deep=True)
3825- 5136
3826+ 5140
38263827 """
38273828 result = self ._constructor_sliced (
38283829 [c .memory_usage (index = False , deep = deep ) for col , c in self .items ()],
@@ -4392,11 +4393,11 @@ def _setitem(self, key, value) -> None:
43924393 >>> s = pd.Series([100, 200], index=["b", "d"])
43934394 >>> df["B"] = s
43944395 >>> df
4395- A B
4396- a 1 NaN
4397- b 2 100
4398- c 3 NaN
4399- d 4 200
4396+ A B
4397+ a 1 NaN
4398+ b 2 100.0
4399+ c 3 NaN
4400+ d 4 200.0
44004401
44014402 Series index labels NOT in DataFrame, ignored:
44024403
@@ -4408,7 +4409,6 @@ def _setitem(self, key, value) -> None:
44084409 x 1 10
44094410 y 2 20
44104411 z 3 50
4411- # Values for 'a' and 'b' are completely ignored!
44124412 """
44134413 key = com .apply_if_callable (key , self )
44144414
@@ -5121,6 +5121,7 @@ def eval(self, expr: str, *, inplace: bool = False, **kwargs) -> Any | None:
51215121 2 6
51225122 3 8
51235123 4 10
5124+ Name: A, dtype: int64
51245125 """
51255126 from pandas .core .computation .eval import eval as _eval
51265127
@@ -7810,10 +7811,10 @@ def value_counts(
78107811
78117812 >>> df.value_counts(dropna=False)
78127813 first_name middle_name
7814+ John Smith 1
78137815 Anne NaN 1
7816+ John NaN 1
78147817 Beth Louise 1
7815- John Smith 1
7816- NaN 1
78177818 Name: count, dtype: int64
78187819
78197820 >>> df.value_counts("first_name")
@@ -9095,10 +9096,10 @@ def combine(
90959096 2 3.0 NaN NaN
90969097
90979098 >>> df2.combine(df1, take_smaller, overwrite=False)
9098- A B C
9099- 0 0.0 NaN NaN
9100- 1 0 .0 3 .0 1 .0
9101- 2 NaN 3.0 1.0
9099+ B C A
9100+ 0 NaN NaN 0.0
9101+ 1 3 .0 1 .0 0 .0
9102+ 2 3.0 1.0 NaN
91029103 """
91039104 other_idxlen = len (other .index ) # save for compare
91049105 other_columns = other .columns
@@ -10954,8 +10955,8 @@ def apply(
1095410955 ``apply`` has type stability (variables in the function do not change their
1095510956 type during the execution).
1095610957
10957- >>> import bodo
10958- >>> df.apply(lambda x: x.A + x.B, axis=1, engine=bodo.jit)
10958+ >>> import bodo # doctest: +SKIP
10959+ >>> df.apply(lambda x: x.A + x.B, axis=1, engine=bodo.jit) # doctest: +SKIP
1095910960
1096010961 Note that JIT compilation is only recommended for functions that take a
1096110962 significant amount of time to run. Fast functions are unlikely to run faster
@@ -12131,7 +12132,7 @@ def _get_data() -> DataFrame:
1213112132 df = df .astype (dtype )
1213212133 arr = concat_compat (list (df ._iter_column_arrays ()))
1213312134 return arr ._reduce (name , skipna = skipna , keepdims = False , ** kwds )
12134- return func (df .values )
12135+ return maybe_unbox_numpy_scalar ( func (df .values ) )
1213512136 elif axis == 1 :
1213612137 if len (df .index ) == 0 :
1213712138 # Taking a transpose would result in no columns, losing the dtype.
@@ -13283,8 +13284,8 @@ def kurt(
1328313284
1328413285 With axis=None
1328513286
13286- >>> df.kurt(axis=None).round(6)
13287- -0.988693
13287+ >>> df.kurt(axis=None)
13288+ -0.9886927196984727
1328813289
1328913290 Using axis=1
1329013291
@@ -13465,7 +13466,7 @@ def idxmin(
1346513466 Pork consumption
1346613467 Wheat Products co2_emissions
1346713468 Beef consumption
13468- dtype: object
13469+ dtype: str
1346913470 """
1347013471 axis = self ._get_axis_number (axis )
1347113472
0 commit comments