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

Method _simple_new

pandas/core/indexes/base.py:653–678  ·  view source on GitHub ↗

We require that we have a dtype compat for the values. If we are passed a non-dtype compat, then coerce using the constructor. Must be careful not to recurse.

(
        cls,
        values: ArrayLike,
        name: Hashable | None = None,
        refs: BlockValuesRefs | None = None,
    )

Source from the content-addressed store, hash-verified

651
652 @classmethod
653 def _simple_new(
654 cls,
655 values: ArrayLike,
656 name: Hashable | None = None,
657 refs: BlockValuesRefs | None = None,
658 ) -> Self:
659 """
660 We require that we have a dtype compat for the values. If we are passed
661 a non-dtype compat, then coerce using the constructor.
662
663 Must be careful not to recurse.
664 """
665 assert isinstance(values, cls._data_cls), type(values)
666
667 result = object.__new__(cls)
668 result._data = values
669 result._name = name
670 result._cache = {}
671 result._reset_identity()
672 if refs is not None:
673 result._references = refs
674 else:
675 result._references = BlockValuesRefs()
676 result._references.add_index_reference(result)
677
678 return result
679
680 @classmethod
681 def _with_infer(cls, *args, **kwargs):

Callers 15

_shallow_copyMethod · 0.95
_viewMethod · 0.95
time_fastpathMethod · 0.45
make_blockFunction · 0.45
make_na_arrayFunction · 0.45
default_indexFunction · 0.45
__new__Method · 0.45

Calls 2

_reset_identityMethod · 0.80
__new__Method · 0.45

Tested by 1