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

Partly fix #1493: error message changed #1515

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
4 changes: 3 additions & 1 deletion narwhals/_pandas_like/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from narwhals._pandas_like.utils import select_columns_by_name
from narwhals._pandas_like.utils import set_axis
from narwhals._pandas_like.utils import to_datetime
from narwhals.dependencies import get_numpy
from narwhals.utils import Implementation
from narwhals.utils import import_dtypes_module

Expand Down Expand Up @@ -112,7 +113,8 @@ def __getitem__(self, idx: int) -> Any: ...
def __getitem__(self, idx: slice | Sequence[int]) -> Self: ...

def __getitem__(self, idx: int | slice | Sequence[int]) -> Any | Self:
if isinstance(idx, int):
np = get_numpy()
if np.isscalar(idx):
FBruzzesi marked this conversation as resolved.
Show resolved Hide resolved
return self._native_series.iloc[idx]
return self._from_native_series(self._native_series.iloc[idx])

Expand Down
Loading