Skip to content

ENH: Infer column dtype when constructing object with pd.NA #58366

Open
@amanlai

Description

@amanlai

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

When a list that contains integers and pd.NAs is cast in a pandas object, the column becomes dtype=object. An example illustrating the issue:

Feature Description

pd.Series([pd.NA, 1]).dtype            # object

Alternative Solutions

Is it possible to cast it into an Extension Dtype such as 'Int64' or at least a numeric dtype such as float64 or Float64?

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Dtype ConversionsUnexpected or buggy dtype conversionsEnhancementNA - MaskedArraysRelated to pd.NA and nullable extension arraysNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions