我们说我有以下命令:
comb = ((x, y, (256 - (x - y))/100) for x, y in combinations(df['hh'], 2) if x != y)
series = Series(list(g) for k, g in groupby(comb, key=itemgetter(0)))
我还有另一行名为df [' name']而我想得的是:
series = ((x, y, (256 - (x - y))/100) for x, y in combinations(df['hh'], 2) if df['name'].x.split('_')[0] != df['name'].y.split('_')[0])
我怎么能这样做?
修改 我的数据框就像
name hh
A_10 12
A_11 10
B_10 7
B_11 6
B_12 5
C_09 14