@@ -464,8 +464,7 @@ def _simple_new(cls, values, name: Label = None):
464
464
# _index_data is a (temporary?) fix to ensure that the direct data
465
465
# manipulation we do in `_libs/reduction.pyx` continues to work.
466
466
# We need access to the actual ndarray, since we're messing with
467
- # data buffers and strides. We don't re-use `_ndarray_values`, since
468
- # we actually set this value too.
467
+ # data buffers and strides.
469
468
result ._index_data = values
470
469
result ._name = name
471
470
result ._cache = {}
@@ -625,7 +624,8 @@ def ravel(self, order="C"):
625
624
--------
626
625
numpy.ndarray.ravel
627
626
"""
628
- return self ._ndarray_values .ravel (order = order )
627
+ values = self ._get_engine_target ()
628
+ return values .ravel (order = order )
629
629
630
630
def view (self , cls = None ):
631
631
@@ -3846,29 +3846,24 @@ def _values(self) -> Union[ExtensionArray, np.ndarray]:
3846
3846
"""
3847
3847
The best array representation.
3848
3848
3849
- This is an ndarray or ExtensionArray. This differs from
3850
- ``_ndarray_values``, which always returns an ndarray.
3849
+ This is an ndarray or ExtensionArray.
3851
3850
3852
- Both ``_values`` and ``_ndarray_values`` are consistent between
3853
- ``Series`` and ``Index`` (except for datetime64[ns], which returns
3854
- a DatetimeArray for _values on the Index, but ndarray[M8ns] on the
3855
- Series).
3851
+ ``_values`` are consistent between``Series`` and ``Index``.
3856
3852
3857
3853
It may differ from the public '.values' method.
3858
3854
3859
- index | values | _values | _ndarray_values |
3860
- ----------------- | --------------- | ------------- | --------------- |
3861
- Index | ndarray | ndarray | ndarray |
3862
- CategoricalIndex | Categorical | Categorical | ndarray[int] |
3863
- DatetimeIndex | ndarray[M8ns] | DatetimeArray | ndarray[M8ns] |
3864
- DatetimeIndex[tz] | ndarray[M8ns] | DatetimeArray | ndarray[M8ns] |
3865
- PeriodIndex | ndarray[object] | PeriodArray | ndarray[int] |
3866
- IntervalIndex | IntervalArray | IntervalArray | ndarray[object] |
3855
+ index | values | _values |
3856
+ ----------------- | --------------- | ------------- |
3857
+ Index | ndarray | ndarray |
3858
+ CategoricalIndex | Categorical | Categorical |
3859
+ DatetimeIndex | ndarray[M8ns] | DatetimeArray |
3860
+ DatetimeIndex[tz] | ndarray[M8ns] | DatetimeArray |
3861
+ PeriodIndex | ndarray[object] | PeriodArray |
3862
+ IntervalIndex | IntervalArray | IntervalArray |
3867
3863
3868
3864
See Also
3869
3865
--------
3870
3866
values
3871
- _ndarray_values
3872
3867
"""
3873
3868
return self ._data
3874
3869
0 commit comments