Skip to content

PERF: non-numeric fillna #20300

Open
Open
@TomAugspurger

Description

@TomAugspurger

Split from a35f93c

# ffill / bfill
# The basic idea is to create an array of integer positions.
# Internally, we use iNaT and the datetime filling routines
# to avoid floating-point NaN. Once filled, we take on `self`
# to get the actual values.
func = pad_1d if method == 'pad' else backfill_1d
idx = np.arange(len(self), dtype='int64')
idx[mask] = iNaT
idx = _ensure_platform_int(func(idx, mask=mask,
                                limit=limit,
                                dtype='datetime64[ns]'))
idx[idx == iNaT] = -1  # missing value marker for take.
new_values = self.take(idx)

self is a non-numeric array-like thing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Missing-datanp.nan, pd.NaT, pd.NA, dropna, isnull, interpolatePerformanceMemory or execution speed performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions