diff --git a/pandas/core/arrays/categorical.py b/pandas/core/arrays/categorical.py index f2e54185c11ff..7197994bfbcb1 100644 --- a/pandas/core/arrays/categorical.py +++ b/pandas/core/arrays/categorical.py @@ -1673,13 +1673,6 @@ def sort_values( [5, 2, 2, 1, 1] Categories (3, int64): [1, 2, 5] - Inplace sorting can be done as well: - - >>> c.sort_values(inplace=True) - >>> c - [1, 1, 2, 2, 5] - Categories (3, int64): [1, 2, 5] - >>> >>> c = pd.Categorical([1, 2, 2, 1, 5]) 'sort_values' behaviour with NaNs. Note that 'na_position' diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 36a7ef7cd6d9e..4f13ead4005e7 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -4512,17 +4512,6 @@ def eval(self, expr: str, *, inplace: bool = False, **kwargs) -> Any | None: 3 4 4 4 5 2 - Use ``inplace=True`` to modify the original DataFrame. - - >>> df.eval('C = A + B', inplace=True) - >>> df - A B C - 0 1 10 11 - 1 2 8 10 - 2 3 6 9 - 3 4 4 8 - 4 5 2 7 - Multiple columns can be assigned to using multi-line expressions: >>> df.eval( @@ -4998,14 +4987,6 @@ def align( 0 1 4 1 2 5 2 3 6 - - Now, update the labels without copying the underlying data. - - >>> df.set_axis(['i', 'ii'], axis='columns', copy=False) - i ii - 0 1 4 - 1 2 5 - 2 3 6 """ ) @Substitution( @@ -6372,13 +6353,6 @@ def dropna( name toy born 1 Batman Batmobile 1940-04-25 2 Catwoman Bullwhip NaT - - Keep the DataFrame with valid entries in the same variable. - - >>> df.dropna(inplace=True) - >>> df - name toy born - 1 Batman Batmobile 1940-04-25 """ if (how is not no_default) and (thresh is not no_default): raise TypeError( diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 8fa86e80e1a44..6211248129ee6 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -6216,17 +6216,6 @@ def astype( dtype: category Categories (2, int64): [2 < 1] - Note that using ``copy=False`` and changing data on a new - pandas object may propagate changes: - - >>> s1 = pd.Series([1, 2]) - >>> s2 = s1.astype('int64', copy=False) - >>> s2[0] = 10 - >>> s1 # note that s1[0] has changed too - 0 10 - 1 2 - dtype: int64 - Create a series of dates: >>> ser_date = pd.Series(pd.date_range('20200101', periods=3)) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 993fefdc91aa0..3eef90343bdf6 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1745,13 +1745,7 @@ def set_names( ( 'cobra', 2018), ( 'cobra', 2019)], ) - >>> idx.set_names(['kind', 'year'], inplace=True) - >>> idx - MultiIndex([('python', 2018), - ('python', 2019), - ( 'cobra', 2018), - ( 'cobra', 2019)], - names=['kind', 'year']) + >>> idx = idx.set_names(['kind', 'year']) >>> idx.set_names('species', level=0) MultiIndex([('python', 2018), ('python', 2019), diff --git a/pandas/core/series.py b/pandas/core/series.py index ed23edc55805d..abe31d0dbd52a 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -1494,17 +1494,6 @@ def reset_index( 3 4 Name: foo, dtype: int64 - To update the Series in place, without generating a new one - set `inplace` to True. Note that it also requires ``drop=True``. - - >>> s.reset_index(inplace=True, drop=True) - >>> s - 0 1 - 1 2 - 2 3 - 3 4 - Name: foo, dtype: int64 - The `level` parameter is interesting for Series with a multi-level index. @@ -2242,11 +2231,9 @@ def drop_duplicates( Name: animal, dtype: object The value ``False`` for parameter 'keep' discards all sets of - duplicated entries. Setting the value of 'inplace' to ``True`` performs - the operation inplace and returns ``None``. + duplicated entries. - >>> s.drop_duplicates(keep=False, inplace=True) - >>> s + >>> s.drop_duplicates(keep=False) 1 cow 3 beetle 5 hippo @@ -3490,17 +3477,6 @@ def sort_values( 0 NaN dtype: float64 - Sort values inplace - - >>> s.sort_values(ascending=False, inplace=True) - >>> s - 3 10.0 - 4 5.0 - 2 3.0 - 1 1.0 - 0 NaN - dtype: float64 - Sort values putting NAs first >>> s.sort_values(na_position='first') @@ -3750,16 +3726,6 @@ def sort_index( 1 c dtype: object - Sort Inplace - - >>> s.sort_index(inplace=True) - >>> s - 1 c - 2 b - 3 a - 4 d - dtype: object - By default NaNs are put at the end, but use `na_position` to place them at the beginning @@ -5619,14 +5585,6 @@ def dropna( 1 2.0 dtype: float64 - Keep the Series with valid entries in the same variable. - - >>> ser.dropna(inplace=True) - >>> ser - 0 1.0 - 1 2.0 - dtype: float64 - Empty strings are not considered NA values. ``None`` is considered an NA value.