0
0
SciPydata~10 mins

Why interpolation estimates between data points in SciPy - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the interpolation function from scipy.

SciPy
from scipy.interpolate import [1]
Drag options to blanks, or click blank then click option'
Ainterp1d
Binterpolate
Cinterpolator
Dinterpolate1d
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'interpolate' which is the module, not the function.
Using 'interpolator' which is not a valid function in scipy.
Using 'interpolate1d' which is not the correct function name.
2fill in blank
medium

Complete the code to create an interpolation function for given x and y data.

SciPy
f = interp1d(x, y, kind=[1])
Drag options to blanks, or click blank then click option'
A'random'
B'smooth'
C'linear'
D'step'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'smooth' which is not a valid kind in interp1d.
Using 'random' which does not make sense for interpolation.
Using 'step' which is a valid kind but not the basic linear interpolation.
3fill in blank
hard

Fix the error in the code to correctly interpolate new x values.

SciPy
y_new = f([1])
Drag options to blanks, or click blank then click option'
Ax_new
By
Cx
Df
Attempts:
3 left
💡 Hint
Common Mistakes
Passing y instead of new x values.
Passing x which are original points, not new points.
Passing f itself which is a function, not data.
4fill in blank
hard

Fill both blanks to create a dictionary of interpolated values for x_new points greater than 2.

SciPy
result = {xi: f(xi) for xi in [1] if xi [2] 2}
Drag options to blanks, or click blank then click option'
Ax_new
Bx
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using original x instead of x_new.
Using '<' instead of '>' which selects wrong values.
5fill in blank
hard

Fill all three blanks to create a dictionary of squared values for x_new points less than 5.

SciPy
squares = { [1]: [2]**2 for [1] in x_new if [1] [3] 5 }
Drag options to blanks, or click blank then click option'
Axi
C<
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names inconsistently.
Using '>' instead of '<' which selects wrong values.