Skip to content

DataFrame constructor is inconsistent in handling of duplicates in columns #24389

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
TomAugspurger opened this issue Dec 21, 2018 · 1 comment
Labels
DataFrame DataFrame data structure Dtype Conversions Unexpected or buggy dtype conversions

Comments

@TomAugspurger
Copy link
Contributor

In [5]: pd.DataFrame(columns=['a', 'a', 'b'])
Out[5]:
Empty DataFrame
Columns: [a, b]
Index: []

In [6]: pd.DataFrame.from_records({}, columns=['a', 'a', 'b'])
Out[6]:
Empty DataFrame
Columns: [a, a, b]
Index: []

I don't know which is preferred.

This is not being fixed in #24387

@TomAugspurger TomAugspurger added Dtype Conversions Unexpected or buggy dtype conversions DataFrame DataFrame data structure labels Dec 21, 2018
@TomAugspurger
Copy link
Contributor Author

Whoops, my Out[5] was on the wrong branch. On master it matches from_records, which makes my life in #24387 harder.

In [9]: pd.DataFrame(columns=['a', 'a', 'b'])
Out[9]:
Empty DataFrame
Columns: [a, a, b]
Index: []

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DataFrame DataFrame data structure Dtype Conversions Unexpected or buggy dtype conversions
Projects
None yet
Development

No branches or pull requests

1 participant