Generation

generate functionTue, 21 Mar 2023

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.stats as stats def mann_whitney_test(data1, data2, alpha=0.05): stat, p = stats.mannwhitneyu(data1, data2) print('Statistics=%.3f, p=%.3f' % (stat, p)) if p > alpha: print('Same distribution (fail to reject H0)') else: print('Different distribution (reject H0)') mann_whitney_test(data[data['version'] == 'gate_30']['sum_gamerounds'], data[data['version'] == 'gate_40']['sum_gamerounds'])

Questions about programming?Chat with your personal AI assistant