@@ -464,8 +464,7 @@ def _simple_new(cls, values, name: Label = None):
464464 # _index_data is a (temporary?) fix to ensure that the direct data
465465 # manipulation we do in `_libs/reduction.pyx` continues to work.
466466 # 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.
469468 result ._index_data = values
470469 result ._name = name
471470 result ._cache = {}
@@ -625,7 +624,8 @@ def ravel(self, order="C"):
625624 --------
626625 numpy.ndarray.ravel
627626 """
628- return self ._ndarray_values .ravel (order = order )
627+ values = self ._get_engine_target ()
628+ return values .ravel (order = order )
629629
630630 def view (self , cls = None ):
631631
@@ -3846,29 +3846,24 @@ def _values(self) -> Union[ExtensionArray, np.ndarray]:
38463846 """
38473847 The best array representation.
38483848
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.
38513850
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``.
38563852
38573853 It may differ from the public '.values' method.
38583854
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 |
38673863
38683864 See Also
38693865 --------
38703866 values
3871- _ndarray_values
38723867 """
38733868 return self ._data
38743869
0 commit comments