Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Feb 26, 2024
1 parent 1f8ffc9 commit 763bdc9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
9 changes: 6 additions & 3 deletions narwhals/pandas_like/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def __init__(
DataFrame this column originates from.
"""

self._name = series.name
assert self._name is not None
self._name = str(series.name) if series.name is not None else ""
self._series = reset_index(series)
self._implementation = implementation

Expand All @@ -58,7 +57,11 @@ def _from_series(self, series: Any) -> Self:

@property
def name(self) -> str:
return self._name # type: ignore[no-any-return]
return self._name

@property
def shape(self) -> tuple[int]:
return self._series.shape # type: ignore[no-any-return]

@property
def series(self) -> Any:
Expand Down
4 changes: 4 additions & 0 deletions narwhals/polars.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ def alias(self, name: str) -> Self:
def name(self) -> str:
return self._series.name

@property
def shape(self) -> tuple[int]:
return self._series.shape

def cast(
self,
dtype: DType, # type: ignore[override]
Expand Down
4 changes: 4 additions & 0 deletions narwhals/spec/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ def alias(self, name: str) -> Self:
def name(self) -> str:
...

@property
def shape(self) -> tuple[int]:
...

def cast(self, dtype: DType) -> Self:
...

Expand Down

0 comments on commit 763bdc9

Please sign in to comment.