27
27
from pandas ._libs .lib import is_datetime_array , no_default
28
28
from pandas ._libs .tslibs import IncompatibleFrequency , OutOfBoundsDatetime , Timestamp
29
29
from pandas ._libs .tslibs .timezones import tz_compare
30
- from pandas ._typing import AnyArrayLike , Dtype , DtypeObj , Label , Shape , final
30
+ from pandas ._typing import AnyArrayLike , ArrayLike , Dtype , DtypeObj , Label , Shape , final
31
31
from pandas .compat .numpy import function as nv
32
32
from pandas .errors import DuplicateLabelError , InvalidIndexError
33
33
from pandas .util ._decorators import Appender , cache_readonly , doc
@@ -1164,7 +1164,7 @@ def to_series(self, index=None, name=None):
1164
1164
if name is None :
1165
1165
name = self .name
1166
1166
1167
- return Series (self .values .copy (), index = index , name = name )
1167
+ return Series (self ._values .copy (), index = index , name = name )
1168
1168
1169
1169
def to_frame (self , index : bool = True , name = None ):
1170
1170
"""
@@ -4036,7 +4036,7 @@ def _wrap_joined_index(
4036
4036
# Uncategorized Methods
4037
4037
4038
4038
@property
4039
- def values (self ) -> np . ndarray :
4039
+ def values (self ) -> ArrayLike :
4040
4040
"""
4041
4041
Return an array representing the data in the Index.
4042
4042
@@ -4055,7 +4055,7 @@ def values(self) -> np.ndarray:
4055
4055
Index.array : Reference to the underlying data.
4056
4056
Index.to_numpy : A NumPy array representing the underlying data.
4057
4057
"""
4058
- return self ._data . view ( np . ndarray )
4058
+ return self ._data
4059
4059
4060
4060
@cache_readonly
4061
4061
@doc (IndexOpsMixin .array )
@@ -5318,7 +5318,7 @@ def _maybe_cast_slice_bound(self, label, side: str_t, kind):
5318
5318
# wish to have special treatment for floats/ints, e.g. Float64Index and
5319
5319
# datetimelike Indexes
5320
5320
# reject them, if index does not contain label
5321
- if (is_float (label ) or is_integer (label )) and label not in self .values :
5321
+ if (is_float (label ) or is_integer (label )) and label not in self ._values :
5322
5322
raise self ._invalid_indexer ("slice" , label )
5323
5323
5324
5324
return label
0 commit comments