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

Pandas 2.x support #5758

Merged
merged 2 commits into from
Feb 8, 2024
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
2 changes: 1 addition & 1 deletion python/cuml/benchmark/datagen.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def _gen_data_regression(
)

X_df = cudf.DataFrame(X_arr)
y_df = cudf.Series(y_arr)
y_df = cudf.Series(np.squeeze(y_arr))

return X_df, y_df

Expand Down
3 changes: 2 additions & 1 deletion python/cuml/common/sparsefuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ def create_csr_matrix_from_count_df(

doc_token_counts = count_df["doc_id"].value_counts().reset_index()
del count_df

doc_token_counts = doc_token_counts.rename(
{"doc_id": "token_counts", "index": "doc_id"}, axis=1
{"count": "token_counts"}, axis=1
).sort_values(by="doc_id")

token_counts = _insert_zeros(
Expand Down
2 changes: 1 addition & 1 deletion python/cuml/preprocessing/encoders.py
Original file line number Diff line number Diff line change
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(Index(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
4 changes: 2 additions & 2 deletions python/cuml/tests/test_train_test_split.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_split_dataframe(train_size, shuffle):
assert all(X_test.index.to_pandas() == y_test.index.to_pandas())

X_reconstructed = cudf.concat([X_train, X_test]).sort_values(by=["x"])
y_reconstructed = y_train.append(y_test).sort_values()
y_reconstructed = cudf.concat([y_train, y_test]).sort_values()

assert all(X_reconstructed.reset_index(drop=True) == X)
out = y_reconstructed.reset_index(drop=True).values_host == y.values_host
Expand Down Expand Up @@ -96,7 +96,7 @@ def test_split_column():
)

X_reconstructed = cudf.concat([X_train, X_test]).sort_values(by=["x"])
y_reconstructed = y_train.append(y_test).sort_values()
y_reconstructed = cudf.concat([y_train, y_test]).sort_values()

assert all(
data
Expand Down
Loading