|
16 | 16 | import functools
|
17 | 17 | from io import StringIO
|
18 | 18 | import itertools
|
19 |
| -import sys |
20 | 19 | from textwrap import dedent
|
21 | 20 | from typing import (
|
22 | 21 | TYPE_CHECKING,
|
|
49 | 48 | from pandas._libs.hashtable import duplicated
|
50 | 49 | from pandas._libs.lib import (
|
51 | 50 | NoDefault,
|
52 |
| - is_range_indexer, |
| 51 | + array_equal_fast, |
53 | 52 | no_default,
|
54 | 53 | )
|
55 | 54 | from pandas._typing import (
|
|
92 | 91 | WriteBuffer,
|
93 | 92 | npt,
|
94 | 93 | )
|
95 |
| -from pandas.compat import PYPY |
96 | 94 | from pandas.compat._optional import import_optional_dependency
|
97 | 95 | from pandas.compat.numpy import (
|
98 | 96 | function as nv,
|
99 | 97 | np_percentile_argname,
|
100 | 98 | )
|
101 |
| -from pandas.errors import ( |
102 |
| - ChainedAssignmentError, |
103 |
| - InvalidIndexError, |
104 |
| - _chained_assignment_msg, |
105 |
| -) |
| 99 | +from pandas.errors import InvalidIndexError |
106 | 100 | from pandas.util._decorators import (
|
107 | 101 | Appender,
|
108 | 102 | Substitution,
|
@@ -3868,10 +3862,6 @@ def isetitem(self, loc, value) -> None:
|
3868 | 3862 | self._iset_item_mgr(loc, arraylike, inplace=False)
|
3869 | 3863 |
|
3870 | 3864 | def __setitem__(self, key, value):
|
3871 |
| - if not PYPY and using_copy_on_write(): |
3872 |
| - if sys.getrefcount(self) <= 3: |
3873 |
| - raise ChainedAssignmentError(_chained_assignment_msg) |
3874 |
| - |
3875 | 3865 | key = com.apply_if_callable(key, self)
|
3876 | 3866 |
|
3877 | 3867 | # see if we can slice the rows
|
@@ -6734,7 +6724,7 @@ def sort_values(
|
6734 | 6724 | else:
|
6735 | 6725 | return self.copy(deep=None)
|
6736 | 6726 |
|
6737 |
| - if is_range_indexer(indexer, len(indexer)): |
| 6727 | + if array_equal_fast(indexer, np.arange(0, len(indexer), dtype=indexer.dtype)): |
6738 | 6728 | if inplace:
|
6739 | 6729 | return self._update_inplace(self)
|
6740 | 6730 | else:
|
@@ -6932,8 +6922,8 @@ def value_counts(
|
6932 | 6922 |
|
6933 | 6923 | Parameters
|
6934 | 6924 | ----------
|
6935 |
| - subset : mapping, function, label, list of labels, optional |
6936 |
| - Columns to use when counting unique combinations. |
| 6925 | + subset : label or list of labels, optional |
| 6926 | + Column(s) to use when counting unique combinations. |
6937 | 6927 | normalize : bool, default False
|
6938 | 6928 | Return proportions rather than frequencies.
|
6939 | 6929 | sort : bool, default True
|
@@ -10887,7 +10877,11 @@ def quantile(
|
10887 | 10877 | f"Invalid method: {method}. Method must be in {valid_method}."
|
10888 | 10878 | )
|
10889 | 10879 | if method == "single":
|
10890 |
| - res = data._mgr.quantile(qs=q, axis=1, interpolation=interpolation) |
| 10880 | + # error: Argument "qs" to "quantile" of "BlockManager" has incompatible type |
| 10881 | + # "Index"; expected "Float64Index" |
| 10882 | + res = data._mgr.quantile( |
| 10883 | + qs=q, axis=1, interpolation=interpolation # type: ignore[arg-type] |
| 10884 | + ) |
10891 | 10885 | elif method == "table":
|
10892 | 10886 | valid_interpolation = {"nearest", "lower", "higher"}
|
10893 | 10887 | if interpolation not in valid_interpolation:
|
|
0 commit comments