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

[BUG] DataFrame iloc indexing is incorrect for boolean mask of columns #13265

Closed
Tracked by #12793
wence- opened this issue May 2, 2023 · 0 comments · Fixed by #13402
Closed
Tracked by #12793

[BUG] DataFrame iloc indexing is incorrect for boolean mask of columns #13265

wence- opened this issue May 2, 2023 · 0 comments · Fixed by #13402
Assignees
Labels
bug Something isn't working improvement Improvement / enhancement to an existing function Python Affects Python cuDF API.

Comments

@wence-
Copy link
Contributor

wence- commented May 2, 2023

Describe the bug

import cudf
import pandas as pd
import numpy as np
df = pd.DataFrame(np.zeros((2, 2)))
cdf = cudf.from_pandas(df)

df.iloc[:, [True, True]]
#     0    1
# 0  0.0  0.0
# 1  0.0  0.0

cdf.iloc[:, [True, True]]
#      1
# 0  0.0
# 1  0.0

This happens because the indexing in pandas treats a boolean mask specially in both the row and column slot, however cudf only does so in the row slot.

There's another (related) bug in terms of the number of columns that are returned but that is separate (#13266).

Expected behavior

Should probably match pandas.

@wence- wence- added bug Something isn't working Python Affects Python cuDF API. improvement Improvement / enhancement to an existing function labels May 2, 2023
@wence- wence- self-assigned this May 2, 2023
wence- added a commit to wence-/cudf that referenced this issue May 11, 2023
Removes need for repeated code in dataframe handling.

- Closes rapidsai#13265
wence- added a commit to wence-/cudf that referenced this issue May 24, 2023
These must be treated specially and not accidentally converted to
integers before indexing.

- Closes rapidsai#13015
- Closes rapidsai#13265
- Closes rapidsai#13270
@rapids-bot rapids-bot bot closed this as completed in 85699df May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working improvement Improvement / enhancement to an existing function Python Affects Python cuDF API.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant