done
This commit is contained in:
18
lib/python3.11/site-packages/narwhals/_arrow/series_cat.py
Normal file
18
lib/python3.11/site-packages/narwhals/_arrow/series_cat.py
Normal file
@ -0,0 +1,18 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pyarrow as pa
|
||||
|
||||
from narwhals._arrow.utils import ArrowSeriesNamespace
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from narwhals._arrow.series import ArrowSeries
|
||||
from narwhals._arrow.typing import Incomplete
|
||||
|
||||
|
||||
class ArrowSeriesCatNamespace(ArrowSeriesNamespace):
|
||||
def get_categories(self) -> ArrowSeries:
|
||||
# NOTE: Should be `list[pa.DictionaryArray]`, but `DictionaryArray` has no attributes
|
||||
chunks: Incomplete = self.native.chunks
|
||||
return self.with_native(pa.concat_arrays(x.dictionary for x in chunks).unique())
|
Reference in New Issue
Block a user