''' Try Smallest correlation ''' # Get smallest Correlation smallest_correlation = correlation_waves.idxmin(axis=1) ''' Try No correlation ''' smallest_correlation = correlation_waves.idxmax(axis=1) ''' Try Smallest Correlation with smallest pairs ''' smallest_correlation = correlation_waves.idxmin(axis=1) first = pd.DataFrame(location_measure.aud) first.columns = ['first'] second = pd.DataFrame(location_measure.aud) second.columns = ['second'] first['location'] = first.index second['location'] = second.index for col in location_measure.columns: first_index = location_measure[(location_measure.abs().rank( axis=1)[col] == 1)].index.values second_index = location_measure[(location_measure.abs().rank( axis=1)[col] == 2)].index.values first.loc[first_index] = str(col) second.loc[second_index] = str(col) first['location'] = first.index second['location'] = second.index first_with_slope = slopes_waves.stack().loc[[ tuple(x) for x in first[['location', 'first']].values ]] second_with_slope = slopes_waves.stack().loc[[ tuple(x) for x in second[['location', 'second']].values ]] rank_and_slope = first_with_slope rank_and_slope.columns = ['first', 'first_slope'] rank_and_slope['second'] = second_with_slope