Given the following code and assuming that x, y, and z are properly re-defined for interpolation:
import numpy as np
import scipy as sp
x = np.arange(5,-5.5,0.5)
f = sp.interpolate.interp2d(x, y, z, kind='linear')
Why does the last line give the following error?
'module' object has no attribute 'interpolate'
I solve my problem when I explicitly import interpolate as follows:
from scipy import interpolate
And then call interpolate like so
interpolate.interp2d(x, y, z, kind='linear')
But I don't understand why I have to explicitly import interpolate when I didn't have to explicitly import arange(). Based on other posts and comments below, scipy is organized differently than numpy, and interpolate is itself a submodule (whereas arange() is just a function). Is that it?