Skip to main content
Glama
series_cat.py911 B
from __future__ import annotations from typing import Generic from narwhals.typing import SeriesT class SeriesCatNamespace(Generic[SeriesT]): def __init__(self, series: SeriesT) -> None: self._narwhals_series = series def get_categories(self) -> SeriesT: """Get unique categories from column. Returns: A new Series containing the unique categories. Examples: >>> import pandas as pd >>> import narwhals as nw >>> s_native = pd.Series(["apple", "mango", "mango"], dtype="category") >>> s = nw.from_native(s_native, series_only=True) >>> s.cat.get_categories().to_native() 0 apple 1 mango dtype: object """ return self._narwhals_series._with_compliant( self._narwhals_series._compliant_series.cat.get_categories() )

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Lillard01/chatExcel-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server