MCPcopy
hub / github.com/pandas-dev/pandas / _convert_tolerance

Method _convert_tolerance

pandas/core/indexes/base.py:3885–3901  ·  view source on GitHub ↗
(self, tolerance, target: np.ndarray | Index)

Source from the content-addressed store, hash-verified

3883 )
3884
3885 def _convert_tolerance(self, tolerance, target: np.ndarray | Index) -> np.ndarray:
3886 # override this method on subclasses
3887 tolerance = np.asarray(tolerance)
3888 if target.size != tolerance.size and tolerance.size > 1:
3889 raise ValueError("list-like tolerance size must match target index size")
3890 elif is_numeric_dtype(self) and not np.issubdtype(tolerance.dtype, np.number):
3891 if tolerance.ndim > 0:
3892 raise ValueError(
3893 f"tolerance argument for {type(self).__name__} with dtype "
3894 f"{self.dtype} must contain numeric elements if it is list type"
3895 )
3896
3897 raise ValueError(
3898 f"tolerance argument for {type(self).__name__} with dtype {self.dtype} "
3899 f"must be numeric if it is a scalar: {tolerance!r}"
3900 )
3901 return tolerance
3902
3903 @final
3904 def _get_fill_indexer(

Callers 1

_get_indexerMethod · 0.95

Calls 1

is_numeric_dtypeFunction · 0.90

Tested by

no test coverage detected