Skip to content

Commit edc928b

Browse files
committed
wip
1 parent 6f88d02 commit edc928b

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

narwhals/pandas_like/expr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
from narwhals.spec import ExprStringNamespace as ExprStringNamespaceT
1010
from narwhals.spec import LazyFrame as LazyFrameProtocol
1111
from narwhals.spec import Namespace as NamespaceProtocol
12-
from narwhals.spec import Series as SeriesT
12+
from narwhals.spec import Series as SeriesProtocol
1313
from narwhals.utils import register_expression_call
1414

1515

1616
class Expr(ExprT):
1717
def __init__( # noqa: PLR0913
1818
self,
19-
call: Callable[[DataFrameT | LazyFrameProtocol], list[SeriesT]],
19+
call: Callable[[DataFrameT | LazyFrameProtocol], list[SeriesProtocol]],
2020
*,
2121
depth: int | None,
2222
function_name: str | None,

narwhals/pandas_like/namespace.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from narwhals.spec import IntoExpr
1616
from narwhals.spec import LazyFrame as LazyFrameProtocol
1717
from narwhals.spec import Namespace as NamespaceProtocol
18-
from narwhals.spec import Series as SeriesT
18+
from narwhals.spec import Series as SeriesProtocol
1919
from narwhals.utils import flatten_str
2020
from narwhals.utils import horizontal_concat
2121
from narwhals.utils import parse_into_exprs
@@ -110,7 +110,7 @@ def len(self) -> ExprT:
110110

111111
def _create_expr_from_callable( # noqa: PLR0913
112112
self,
113-
func: Callable[[DataFrameT | LazyFrameProtocol], list[SeriesT]],
113+
func: Callable[[DataFrameT | LazyFrameProtocol], list[SeriesProtocol]],
114114
*,
115115
depth: int,
116116
function_name: str | None,
@@ -126,7 +126,9 @@ def _create_expr_from_callable( # noqa: PLR0913
126126
implementation=self._implementation,
127127
)
128128

129-
def _create_series_from_scalar(self, value: Any, series: SeriesT) -> SeriesT:
129+
def _create_series_from_scalar(
130+
self, value: Any, series: SeriesProtocol
131+
) -> SeriesProtocol:
130132
return Series(
131133
series_from_iterable(
132134
[value],
@@ -138,7 +140,7 @@ def _create_series_from_scalar(self, value: Any, series: SeriesT) -> SeriesT:
138140
implementation=self._implementation,
139141
)
140142

141-
def _create_expr_from_series(self, series: SeriesT) -> ExprT:
143+
def _create_expr_from_series(self, series: SeriesProtocol) -> ExprT:
142144
return Expr(
143145
lambda _df: [series],
144146
depth=0,

narwhals/pandas_like/series.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55

66
from pandas.api.types import is_extension_array_dtype
77

8-
from narwhals.spec import Series as SeriesT
8+
from narwhals.spec import Series as SeriesProtocol
99
from narwhals.utils import item
1010
from narwhals.utils import validate_column_comparand
1111

1212
if TYPE_CHECKING:
1313
from narwhals.pandas_like.namespace import Namespace
1414

1515

16-
class Series(SeriesT):
16+
class Series(SeriesProtocol):
1717
def __init__(
1818
self,
1919
series: Any,
@@ -266,7 +266,7 @@ def n_unique(self) -> int:
266266
ser = self.series
267267
return ser.nunique()
268268

269-
def zip_with(self, mask: SeriesT, other: SeriesT) -> SeriesT:
269+
def zip_with(self, mask: SeriesProtocol, other: SeriesProtocol) -> SeriesProtocol:
270270
ser = self.series
271271
return self._from_series(ser.where(mask, other))
272272

@@ -276,7 +276,7 @@ def sample(self, n: int, fraction: float, *, with_replacement: bool) -> Series:
276276
ser.sample(n=n, frac=fraction, with_replacement=with_replacement)
277277
)
278278

279-
def unique(self) -> SeriesT:
279+
def unique(self) -> SeriesProtocol:
280280
ser = self.series
281281
return ser.unique()
282282

0 commit comments

Comments
 (0)