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

REFACTOR-#5413: check Index.dtype instead of isinstance(obj, Int64Index) #5406

Merged
merged 2 commits into from
Dec 12, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -2558,7 +2558,7 @@ def _is_trivial_index(cls, index):
return True
if isinstance(index, pd.RangeIndex):
return index.start == 0 and index.step == 1
if not isinstance(index, pd.Int64Index):
if not (isinstance(index, pd.Index) and index.dtype == np.int64):
return False
return (
index.is_monotonic_increasing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1214,12 +1214,11 @@ def applier(df, **kwargs):
# At the end of reduce function it does inevitable `transpose`, which
# is defaulting to pandas. The following logic check that `transpose` is the only
# function that falling back to pandas in the reduce operation flow.
# Another warning comes from deprecated pandas.Int64Index usage.
with pytest.warns(UserWarning) as warns:
res = getattr(df, method)()
assert (
len(warns) == 2
), f"More than two warnings were arisen: len(warns) != 2 ({len(warns)} != 2)"
len(warns) == 1
), f"More than one warning was arisen: len(warns) != 1 ({len(warns)} != 1)"
message = warns[0].message.args[0]
assert (
re.match(r".*transpose.*defaulting to pandas", message) is not None
Expand Down