Rewrite this code to calculate statistics by scipy.stats wilcoxon stat, p = mannwhitneyu(data[data['version'] == 'gate_30']['sum_gamerounds'], data[data['version'] == 'gate_40']['sum_gamerounds']) print('Mann-Whitney Statistics=%.3f, p=%.3f' % (stat, p))
import scipy import pandas as pd import numpy as np data = pd.read_csv("cookie_cats.csv") data.head() def mann_whitney_test(data): """ Returns the result of a Mann Whitney test. """ # Calculate statistic and p-value stat, p = scipy.stats.mannwhitneyu(data[data['version'] == 'gate_30']['sum_gamerounds'], data[data['version'] == 'gate_40']['sum_gamerounds']) # Print result print('mann whitney stat=%.3f, p=%.3f' % (stat, p)) mann_whitney_test(data)