-
Notifications
You must be signed in to change notification settings - Fork 908
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
Raise ValueError if DataFrame column length does not match data #14135
Raise ValueError if DataFrame column length does not match data #14135
Conversation
Is the PR title missing a |
Yes, thanks! |
cc @galipremsagar if you have a moment to review |
@@ -645,7 +645,15 @@ def __init__( | |||
elif isinstance(data, (cudf.Series, pd.Series)): | |||
if isinstance(data, pd.Series): | |||
data = cudf.Series.from_pandas(data, nan_as_null=nan_as_null) | |||
|
|||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we shouldn't be raising no?:
In [1]: import pandas as pd
In [2]: s = pd.Series([1, 2, 3], name=2)
In [3]: pd.DataFrame(s)
Out[3]:
2
0 1
1 2
2 3
In [4]: pd.DataFrame(s, columns=[])
Out[4]:
Empty DataFrame
Columns: []
Index: []
In [5]: pd.DataFrame(s, columns=[2])
Out[5]:
2
0 1
1 2
2 3
In [6]: pd.DataFrame(s, columns=[2, 1])
Out[6]:
2 1
0 1 NaN
1 2 NaN
2 3 NaN
In [7]: pd.DataFrame(s, columns=[1])
Out[7]:
Empty DataFrame
Columns: [1]
Index: []
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I guess it's this very narrow use case that should only raise. (I'm not sure of the history why the other cases are allowed)
Description
closes #14131
Checklist