Skip to content

Commit

Permalink
very old pandas
Browse files Browse the repository at this point in the history
  • Loading branch information
FBruzzesi committed Nov 11, 2024
1 parent 4be63d0 commit c068d79
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion narwhals/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,8 +348,17 @@ def maybe_set_index(
if column_names:
msg = "Cannot set index using column names on a Series"
raise ValueError(msg)

if (
df_any._compliant_series._implementation is Implementation.PANDAS
and df_any._compliant_series._backend_version < (1,)
): # pragma: no cover
native_obj = native_obj.set_axis(keys, inplace=False)
else:
native_obj = native_obj.set_axis(keys)

return df_any._from_compliant_series( # type: ignore[no-any-return]
df_any._compliant_series._from_native_series(native_obj.set_axis(keys))
df_any._compliant_series._from_native_series(native_obj)
)
else:
return df_any # type: ignore[no-any-return]
Expand Down

0 comments on commit c068d79

Please sign in to comment.