Generation

generate functionTue, 21 Mar 2023

Rewrite this code to calculate Wilcoxon statistics 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))

# def my_mannwhitneyu(data, col, by): def my_mannwhitneyu(data, col1, col2): # select data for the two conditions # data1 = data[data[by] == 'gate_30'] # data2 = data[data[by] == 'gate_40'] data1 = data[data[col1] == col1] data2 = data[data[col2] == col2] # calculate Mann-Whitney U-statistics and p-value stat, p = mannwhitneyu(data1, data2) print('Statistics=%.3f, p=%.3f' % (stat, p)) return stat, p my_mannwhitneyu(data, 'gate_30', 'gate_40')

Questions about programming?Chat with your personal AI assistant