Skip to content

BUG: Index[Float64].insert(1, False) casts False to 0 #61709

Open
@jbrockmendel

Description

@jbrockmendel

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

idx = pd.Index(pd.array([1., 2., 3., 4]))

>>> idx.insert(1, False)
Index([1.0, 0.0, 2.0, 3.0, 4.0], dtype='Float64')

Issue Description

Discovered while adapting tests.indexing.test_coercion tests to nullable dtypes.

Expected Behavior

To be consistent with other behavior this should keep the False as False and cast to object.

Installed Versions

Replace this line with the output of pd.show_versions()

Metadata

Metadata

Assignees

Labels

BugNeeds TriageIssue that has not been reviewed by a pandas team member

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions