I wonder if there is an easy way to uncover the interp1d object in scipy. The naive approach does not seem to work.
import pickle import numpy as np from scipy.interpolate import interp1d x = np.linspace(0,1,10) y = np.random.rand(10) sp = interp1d(x, y) with open("test.pickle", "wb") as handle: pickle.dump(sp, handle)
This happens after PicklingError:
--------------------------------------------------------------------------- PicklingError Traceback (most recent call last) <ipython-input-1-af4e3326e7d1> in <module>() 10 11 with open("test.pickle", "wb") as handle: ---> 12 pickle.dump(sp, handle) PicklingError: Can't pickle <function interp1d._call_linear at 0x1058abf28>: attribute lookup _call_linear on scipy.interpolate.interpolate failed
source share