Skip to content

BUG: Series.get with Float64Index and numpy nan returns empty Series #8569

Closed
@willpan

Description

@willpan

I tried to use series.get(x) (where x is np.nan in some instance) and the result was an empty series. It seems like it should just return None if it can't be found.

import pandas as pd
import numpy as np

series = pd.Series(range(0, 10))
series.get(np.nan) 
# returns None

series = series.reindex(pd.Float64Index(range(0, 10)))

series.get(10) 
# This correctly returns None

series.get(np.nan) 
# returns empty series with empty Float64Index

series.get(np.nan, np.nan) 
# same thing

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselvesMissing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions