Complete the code to import the chi2_contingency function from scipy.stats.
from scipy.stats import [1]
The chi2_contingency function is the correct function to perform the chi-squared test on a contingency table.
Complete the code to create a contingency table from two categorical columns in a pandas DataFrame named df.
contingency_table = pd.crosstab(df['Category1'], [1])
The pd.crosstab function takes two categorical series to create a contingency table. The second argument should be the other categorical column, here df['Category2'].
Fix the error in the code to perform the chi-squared test on the contingency table named table.
chi2, p, dof, expected = [1](table)The correct function to perform the chi-squared test on a contingency table is chi2_contingency.
Fill both blanks to create a dictionary comprehension that maps each word to its length only if the length is greater than 3.
lengths = {word: [1] for word in words if len(word) [2] 3}The dictionary comprehension maps each word to its length using len(word). The condition filters words with length greater than 3 using >.
Fill all three blanks to create a dictionary comprehension that maps each key uppercased to its value only if the value is greater than 0.
result = [1]: [2] for k, v in data.items() if v [3] 0}
The dictionary comprehension uses k.upper() as the key, v as the value, and filters items where v > 0.