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] Broadast of scalar inputs to the same lengths as other columns in DataFrame constructor #12646

Closed
shwina opened this issue Jan 30, 2023 · 0 comments · Fixed by #12997
Closed
Assignees
Labels
bug Something isn't working Python Affects Python cuDF API.

Comments

@shwina
Copy link
Contributor

shwina commented Jan 30, 2023

In the constructor of cudf.DataFrame, when one or more input "columns" are provided as scalars, they are broadcast to the same length as other input columns:

df = cudf.DataFrame({'a': [1, 2, 3], 'b': ['x', 'y', 'z'], 'c': 4})
print(df)

Output:

   a  b  c
0  1  x  4
1  2  y  4
2  3  z  4

However, if the scalar appears as the first value in the input, cuDF complains about a length mismatch:

df = cudf.DataFrame({'c': 4, 'a': [1, 2, 3], 'b': ['x', 'y', 'z']})  # ValueError
@shwina shwina added bug Something isn't working Needs Triage Need team to review and classify Python Affects Python cuDF API. and removed Needs Triage Need team to review and classify labels Jan 30, 2023
@galipremsagar galipremsagar self-assigned this Jan 30, 2023
rapids-bot bot pushed a commit that referenced this issue Mar 23, 2023
Fixes: #12646

This PR fixes an issue with `DataFrame` where broadcasting scalar inputs was order dependent.

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - Lawrence Mitchell (https://github.com/wence-)

URL: #12997
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants