Complete the code to import the function that calculates descriptive statistics.
from scipy.stats import [1] data = [1, 2, 3, 4, 5] result = describe(data) print(result)
The describe function from scipy.stats calculates descriptive statistics like mean, variance, min, max, and more.
Complete the code to calculate descriptive statistics for the given data list.
from scipy.stats import describe data = [10, 20, 30, 40, 50] result = describe([1]) print(result)
You need to pass the actual data list data to the describe function to get statistics.
Fix the error in the code to correctly calculate descriptive statistics.
from scipy.stats import describe data = [5, 10, 15, 20] result = describe([1]) print(result)
values or items on a list.The describe function expects a list or array. Since data is already a list, pass it directly.
Fill both blanks to create a dictionary of descriptive statistics for words longer than 3 letters.
words = ['data', 'science', 'is', 'fun'] lengths = {word: [1] for word in words if len(word) [2] 3} print(lengths)
We want the length of each word as the value, so use len(word). The condition filters words longer than 3 letters, so use >.
Fill all three blanks to create a filtered dictionary with uppercase keys and values greater than 2.
data = {'a': 1, 'b': 3, 'c': 5}
filtered = {{ [1]: [2] for k, v in data.items() if v [3] 2 }}
print(filtered)Keys are converted to uppercase with k.upper(). Values are kept as v. The filter keeps values greater than 2 using >.