Skip to content

API: pd.concat with len(keys) != len(values) does not raise; intentional? #43485

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

Closed
jbrockmendel opened this issue Sep 9, 2021 · 0 comments · Fixed by #52337
Closed

API: pd.concat with len(keys) != len(values) does not raise; intentional? #43485

jbrockmendel opened this issue Sep 9, 2021 · 0 comments · Fixed by #52337
Labels
API - Consistency Internal Consistency of API/Behavior Error Reporting Incorrect or improved errors from pandas Reshaping Concat, Merge/Join, Stack/Unstack, Explode

Comments

@jbrockmendel
Copy link
Member

jbrockmendel commented Sep 9, 2021

import pandas as pd
ser = pd.Series(range(5))
sers = [ser + n for n in range(4)]
keys = ["A", "B", "C"]

>>> pd.concat(sers, keys=keys, axis=1)
   A  B  C
0  0  1  2
1  1  2  3
2  2  3  4
3  3  4  5
4  4  5  6

I expected the pd.concat below to raise. It kind of makes sense as a reindex or analogue to the DataFrame constructor, but seems more likely to me to be a footgun. In particular, I think the lack of raising may be hiding a bug in the groupby code.

Is not-raising an intentional decision? If so, thoughts on either deprecating or issuing a warning?

@jbrockmendel jbrockmendel added Bug Needs Triage Issue that has not been reviewed by a pandas team member API - Consistency Internal Consistency of API/Behavior Reshaping Concat, Merge/Join, Stack/Unstack, Explode and removed Bug labels Sep 9, 2021
@mroeschke mroeschke added Error Reporting Incorrect or improved errors from pandas and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Error Reporting Incorrect or improved errors from pandas Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants