Skip to content

PERF: remove use of Python sets for interpolate #34727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into interpolate---no-…
…sets-perf
  • Loading branch information
simonjayhawkins committed Jun 14, 2020
commit 0614598cf8d2c55cee9e96aa76821ffc4eeed3c9
28 changes: 3 additions & 25 deletions pandas/core/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,30 +276,7 @@ def interpolate_1d(
result[nans_to_interpolate] = np.interp(
inds[nans_to_interpolate], inds[valid][indexer], yvalues[valid][indexer]
)
return result

sp_methods = [
"nearest",
"zero",
"slinear",
"quadratic",
"cubic",
"barycentric",
"krogh",
"spline",
"polynomial",
"from_derivatives",
"piecewise_polynomial",
"pchip",
"akima",
"cubicspline",
]

if method in sp_methods:
inds = np.asarray(xvalues)
# hack for DatetimeIndex, #1646
if issubclass(inds.dtype.type, np.datetime64):
inds = inds.view(np.int64)
else:
result[nans_to_interpolate] = _interpolate_scipy_wrapper(
inds[valid],
yvalues[valid],
Expand All @@ -310,7 +287,8 @@ def interpolate_1d(
order=order,
**kwargs,
)
return result

return result


def _interpolate_scipy_wrapper(
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.