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

DataFrame constructor silently ignores dtype keyword when values cannot be coerced #24435

Closed
TomAugspurger opened this issue Dec 26, 2018 · 0 comments · Fixed by #41733
Closed
Labels
Bug Constructors Series/DataFrame/Index/pd.array Constructors Dtype Conversions Unexpected or buggy dtype conversions Error Reporting Incorrect or improved errors from pandas
Milestone

Comments

@TomAugspurger
Copy link
Contributor

In [1]: import pandas as pd

In [2]: pd.DataFrame({'A': ['a', 'b']}, dtype=int)
Out[2]:
   A
0  a
1  b

In [3]: pd.DataFrame({'A': ['a', 'b']}, dtype=int).dtypes
Out[3]:
A    object
dtype: object

I propose that we warn that that will raise in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Constructors Series/DataFrame/Index/pd.array Constructors Dtype Conversions Unexpected or buggy dtype conversions Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants