|
10 | 10 | from pandas.core.dtypes.cast import astype_nansafe
|
11 | 11 | from pandas.core.dtypes.common import (
|
12 | 12 | is_bool,
|
13 |
| - is_bool_dtype, |
14 | 13 | is_dtype_equal,
|
15 | 14 | is_extension_array_dtype,
|
16 | 15 | is_float,
|
17 | 16 | is_float_dtype,
|
18 | 17 | is_integer_dtype,
|
19 |
| - is_number, |
20 | 18 | is_numeric_dtype,
|
21 | 19 | is_scalar,
|
22 | 20 | is_signed_integer_dtype,
|
|
25 | 23 | pandas_dtype,
|
26 | 24 | )
|
27 | 25 | from pandas.core.dtypes.generic import ABCSeries
|
28 |
| -from pandas.core.dtypes.missing import is_valid_nat_for_dtype, isna |
29 | 26 |
|
30 | 27 | import pandas.core.common as com
|
31 | 28 | from pandas.core.indexes.base import Index, maybe_extract_name
|
@@ -122,42 +119,6 @@ def _shallow_copy(self, values=None, name: Hashable = lib.no_default):
|
122 | 119 | return Float64Index._simple_new(values, name=name)
|
123 | 120 | return super()._shallow_copy(values=values, name=name)
|
124 | 121 |
|
125 |
| - @doc(Index._validate_fill_value) |
126 |
| - def _validate_fill_value(self, value): |
127 |
| - if is_bool(value) or is_bool_dtype(value): |
128 |
| - # force conversion to object |
129 |
| - # so we don't lose the bools |
130 |
| - raise TypeError |
131 |
| - elif is_scalar(value) and isna(value): |
132 |
| - if is_valid_nat_for_dtype(value, self.dtype): |
133 |
| - value = self._na_value |
134 |
| - if self.dtype.kind != "f": |
135 |
| - # raise so that caller can cast |
136 |
| - raise TypeError |
137 |
| - else: |
138 |
| - # NaT, np.datetime64("NaT"), np.timedelta64("NaT") |
139 |
| - raise TypeError |
140 |
| - |
141 |
| - elif is_scalar(value): |
142 |
| - if not is_number(value): |
143 |
| - # e.g. datetime64, timedelta64, datetime, ... |
144 |
| - raise TypeError |
145 |
| - |
146 |
| - elif lib.is_complex(value): |
147 |
| - # at least until we have a ComplexIndx |
148 |
| - raise TypeError |
149 |
| - |
150 |
| - elif is_float(value) and self.dtype.kind != "f": |
151 |
| - if not value.is_integer(): |
152 |
| - raise TypeError |
153 |
| - value = int(value) |
154 |
| - |
155 |
| - elif hasattr(value, "dtype") and value.dtype.kind in ["m", "M"]: |
156 |
| - # TODO: if we're checking arraylike here, do so systematically |
157 |
| - raise TypeError |
158 |
| - |
159 |
| - return value |
160 |
| - |
161 | 122 | def _convert_tolerance(self, tolerance, target):
|
162 | 123 | tolerance = np.asarray(tolerance)
|
163 | 124 | if target.size != tolerance.size and tolerance.size > 1:
|
|
0 commit comments