Skip to content

ENH: Enable passing in dict to specify datatypes to DataFrame constructor #9133

Closed
@artemyk

Description

@artemyk

The following seems like very natural syntax to specify the dtypes of various columns passed into the DataFrame constructor:

df = pd.DataFrame({'a':[1,2,3], 'b':[2.5,3.5,6.7]}, dtype={'a':'int32','b':'float32'})

However, right now it raises an error. Perhaps something worth implementing? See also http://stackoverflow.com/questions/21197774/assign-pandas-dataframe-column-dtypes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions