Skip to content

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

Closed
@TomAugspurger

Description

@TomAugspurger
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugConstructorsSeries/DataFrame/Index/pd.array ConstructorsDtype ConversionsUnexpected or buggy dtype conversionsError ReportingIncorrect or improved errors from pandas

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions