This is called upon unpickling, rather than the default which doesn't have arguments and breaks __new__.
(cls, d)
| 292 | |
| 293 | |
| 294 | def _new_Index(cls, d): |
| 295 | """ |
| 296 | This is called upon unpickling, rather than the default which doesn't |
| 297 | have arguments and breaks __new__. |
| 298 | """ |
| 299 | # required for backward compat, because PI can't be instantiated with |
| 300 | # ordinals through __new__ GH #13277 |
| 301 | d["copy"] = False |
| 302 | if issubclass(cls, ABCPeriodIndex): |
| 303 | from pandas.core.indexes.period import _new_PeriodIndex |
| 304 | |
| 305 | return _new_PeriodIndex(cls, **d) |
| 306 | |
| 307 | if issubclass(cls, ABCMultiIndex): |
| 308 | if "labels" in d and "codes" not in d: |
| 309 | # GH#23752 "labels" kwarg has been replaced with "codes" |
| 310 | d["codes"] = d.pop("labels") |
| 311 | |
| 312 | # Since this was a valid MultiIndex at pickle-time, we don't need to |
| 313 | # check validty at un-pickle time. |
| 314 | d["verify_integrity"] = False |
| 315 | |
| 316 | elif "dtype" not in d and "data" in d: |
| 317 | # Prevent Index.__new__ from conducting inference; |
| 318 | # "data" key not in RangeIndex |
| 319 | d["dtype"] = d["data"].dtype |
| 320 | return cls.__new__(cls, **d) |
| 321 | |
| 322 | |
| 323 | @set_module("pandas") |
nothing calls this directly
no test coverage detected