Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: simplify internal renaming in _pandas_like/series.py #1847

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions narwhals/_pandas_like/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from narwhals._pandas_like.utils import create_compliant_series
from narwhals._pandas_like.utils import diagonal_concat
from narwhals._pandas_like.utils import horizontal_concat
from narwhals._pandas_like.utils import rename
from narwhals._pandas_like.utils import vertical_concat
from narwhals.typing import CompliantNamespace
from narwhals.utils import import_dtypes_module
Expand Down Expand Up @@ -267,18 +266,13 @@ def func(df: PandasLikeDataFrame) -> list[PandasLikeSeries]:

return [
PandasLikeSeries(
native_series=rename(
self.concat(
(s.to_frame() for s in series), how="horizontal"
)._native_frame.min(axis=1),
series[0].name,
implementation=self._implementation,
backend_version=self._backend_version,
),
self.concat(
(s.to_frame() for s in series), how="horizontal"
)._native_frame.min(axis=1),
implementation=self._implementation,
backend_version=self._backend_version,
version=self._version,
)
).alias(series[0].name)
]

return self._create_expr_from_callable(
Expand All @@ -298,18 +292,13 @@ def func(df: PandasLikeDataFrame) -> list[PandasLikeSeries]:

return [
PandasLikeSeries(
rename(
self.concat(
(s.to_frame() for s in series), how="horizontal"
)._native_frame.max(axis=1),
series[0].name,
implementation=self._implementation,
backend_version=self._backend_version,
),
self.concat(
(s.to_frame() for s in series), how="horizontal"
)._native_frame.max(axis=1),
implementation=self._implementation,
backend_version=self._backend_version,
version=self._version,
)
).alias(series[0].name)
]

return self._create_expr_from_callable(
Expand Down
Loading
Loading