PERF: add ._simple_new method to masked arrays by topper-123 · Pull Request #53013 · pandas-dev/pandas (original) (raw)
Add a ._simple_new
method to BaseMaskedArray
and child classes in order to allow instantiation without validation to get better performance when validation is not needed.
Example:
import pandas as pd arr = pd.array(np.arange(2), dtype="Int32") %timeit arr.reshape(-1, 1) 1.4 µs ± 12 ns per loop # main 544 ns ± 1.87 ns per loop # this PR
Motivated by performance considerations for #52836.