Commit 30ff0b8 1 parent 07f3d0e commit 30ff0b8 Copy full SHA for 30ff0b8
File tree 1 file changed +8
-8
lines changed
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -548,18 +548,18 @@ def maybe_set_index(
548
548
df_any ._compliant_frame ._from_native_frame (native_obj .set_index (keys ))
549
549
)
550
550
elif is_pandas_like_series (native_obj ):
551
+ from narwhals ._pandas_like .utils import set_axis
552
+
551
553
if column_names :
552
554
msg = "Cannot set index using column names on a Series"
553
555
raise ValueError (msg )
554
556
555
- if (
556
- df_any ._compliant_series ._implementation is Implementation .PANDAS
557
- and df_any ._compliant_series ._backend_version < (1 ,)
558
- ): # pragma: no cover
559
- native_obj = native_obj .set_axis (keys , inplace = False )
560
- else :
561
- native_obj = native_obj .set_axis (keys )
562
-
557
+ native_obj = set_axis (
558
+ native_obj ,
559
+ keys ,
560
+ implementation = obj ._compliant_series ._implementation , # type: ignore[union-attr]
561
+ backend_version = obj ._compliant_series ._backend_version , # type: ignore[union-attr]
562
+ )
563
563
return df_any ._from_compliant_series ( # type: ignore[no-any-return]
564
564
df_any ._compliant_series ._from_native_series (native_obj )
565
565
)
You can’t perform that action at this time.
0 commit comments