Skip to content

Commit

Permalink
Use cudf.Index instead of cudf.GenericIndex. (#5738)
Browse files Browse the repository at this point in the history
I saw the cuml docs build failed, with the error below:

```
Failed to import cuml.compose.
Possible hints:
* AttributeError: module 'cudf' has no attribute 'GenericIndex'
* KeyError: 'cuml'
```

This is due to pandas 2 changes in cudf that need updated in cuml. This PR is unlikely to contain the full changeset of things needed for pandas 2 support, but it fixes one problem and we can let CI tell us the rest of the failures.

Authors:
   - Bradley Dice (https://github.com/bdice)

Approvers:
   - Dante Gama Dessavre (https://github.com/dantegd)
  • Loading branch information
bdice authored Feb 1, 2024
1 parent 1a3c1d3 commit 40b5581
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions python/cuml/preprocessing/encoders.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2020-2023, NVIDIA CORPORATION.
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,7 +32,7 @@
cp = gpu_only_import("cupy")
cupyx = gpu_only_import("cupyx")

GenericIndex = gpu_only_import_from("cudf", "GenericIndex")
Index = gpu_only_import_from("cudf", "Index")


class CheckFeaturesMixIn:
Expand Down Expand Up @@ -498,7 +498,7 @@ def inverse_transform(self, X):
dropped_class_idx = Series(self.drop_idx_[feature])
dropped_class_mask = Series(cats).isin(cats[dropped_class_idx])
if len(cats) == 1:
inv = Series(GenericIndex(cats[0]).repeat(X.shape[0]))
inv = Series(Index(cats[0]).repeat(X.shape[0]))
result[feature] = inv
continue
cats = cats[~dropped_class_mask]
Expand Down

0 comments on commit 40b5581

Please sign in to comment.