Return the values. For internal compatibility with pandas formatting. Returns ------- np.ndarray or ExtensionArray A numpy array or ExtensionArray of the same dtype as categorical.categories.dtype.
(self)
| 1937 | return arr._from_backing_data(backing) |
| 1938 | |
| 1939 | def _internal_get_values(self) -> ArrayLike: |
| 1940 | """ |
| 1941 | Return the values. |
| 1942 | |
| 1943 | For internal compatibility with pandas formatting. |
| 1944 | |
| 1945 | Returns |
| 1946 | ------- |
| 1947 | np.ndarray or ExtensionArray |
| 1948 | A numpy array or ExtensionArray of the same dtype as |
| 1949 | categorical.categories.dtype. |
| 1950 | """ |
| 1951 | # if we are a datetime and period index, return Index to keep metadata |
| 1952 | if needs_i8_conversion(self.categories.dtype): |
| 1953 | return self.categories.take(self._codes, fill_value=NaT)._values |
| 1954 | elif is_integer_dtype(self.categories.dtype) and -1 in self._codes: |
| 1955 | return ( |
| 1956 | self.categories.astype("object") |
| 1957 | .take(self._codes, fill_value=np.nan) |
| 1958 | ._values |
| 1959 | ) |
| 1960 | return np.array(self) |
| 1961 | |
| 1962 | def check_for_ordered(self, op) -> None: |
| 1963 | """assert that we are ordered""" |
no test coverage detected