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

Method _simple_new

pandas/core/arrays/timedeltas.py:228–243  ·  view source on GitHub ↗
(  # type: ignore[override]
        cls,
        values: npt.NDArray[np.timedelta64],
        freq: Tick | Day | None = None,
        dtype: np.dtype[np.timedelta64] = TD64NS_DTYPE,
    )

Source from the content-addressed store, hash-verified

226 # error: Signature of "_simple_new" incompatible with supertype "NDArrayBacked"
227 @classmethod
228 def _simple_new( # type: ignore[override]
229 cls,
230 values: npt.NDArray[np.timedelta64],
231 freq: Tick | Day | None = None,
232 dtype: np.dtype[np.timedelta64] = TD64NS_DTYPE,
233 ) -> Self:
234 # Require td64 dtype, not unit-less, matching values.dtype
235 assert lib.is_np_dtype(dtype, "m")
236 assert not tslibs.is_unitless(dtype)
237 assert isinstance(values, np.ndarray), type(values)
238 assert dtype == values.dtype
239 assert freq is None or isinstance(freq, (Tick, Day))
240
241 result = super()._simple_new(values=values, dtype=dtype)
242 result._freq = freq
243 return result
244
245 @classmethod
246 def _from_sequence(cls, data, *, dtype=None, copy: bool = False) -> Self:

Callers 11

_from_sequenceMethod · 0.45
_generate_rangeMethod · 0.45
astypeMethod · 0.45
_accumulateMethod · 0.45
__mul__Method · 0.45
_scalar_divlike_opMethod · 0.45
_vector_divlike_opMethod · 0.45
__neg__Method · 0.45
__pos__Method · 0.45
__abs__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected