Skip to content

Commit

Permalink
Merge branch 'main' into schema-convert-api
Browse files Browse the repository at this point in the history
  • Loading branch information
dangotbanned authored Feb 8, 2025
2 parents 7b89936 + f5314cc commit 10b04d3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion narwhals/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,12 +766,16 @@ def maybe_reset_index(obj: FrameOrSeriesT) -> FrameOrSeriesT:
return obj_any # type: ignore[no-any-return]


def _is_range_index(obj: Any, native_namespace: Any) -> TypeIs[pd.RangeIndex]:
return isinstance(obj, native_namespace.RangeIndex)


def _has_default_index(
native_frame_or_series: pd.Series | pd.DataFrame, native_namespace: Any
) -> bool:
index = native_frame_or_series.index
return (
isinstance(index, native_namespace.RangeIndex)
_is_range_index(index, native_namespace)
and index.start == 0
and index.stop == len(index)
and index.step == 1
Expand Down

0 comments on commit 10b04d3

Please sign in to comment.