Skip to content

Integer dtype is promoted to int64 #2759

Closed
@pprett

Description

@pprett

It seems that DataFrame (both constructor and astype) promotes the dtypes np.int[8,16,32] to np.int64 ::

>>> pd.DataFrame(data=np.ones((10, 2), dtype=np.int32), dtype=np.int32).get_dtype_counts()
int64    2

I'm not sure whether this is a but or on purpose (if so, a note in the docstring would be great).
Is there a specific reason why this is the case (e.g. to accomodate NA values?). If there are no NA's in the frame, can the promotion be turned off?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions