这是我的df:
feature_name combo p_val *
0 VC9 [rest_closed, immediate_recall] 0.0053 **
1 VC9 [rest_music, immediate_recall] 0.0345 *
2 VC9 [rest_wonder, rest_closed] 0.0010 ***
3 VC9 [rest_wonder, rest_music] 0.0043 **
4 VC9 [rest_wonder, rest_open] 0.0075 **
5 Theta [rest_closed, immediate_recall] 0.0098 **
6 Theta [rest_wonder, rest_closed] 0.0038 **
7 Theta [statements, rest_closed] 0.0187 *
8 Gamma [rest_closed, clock] 0.0230 *
9 Gamma [rest_closed, d1] 0.0111 *
10 Gamma [rest_closed, immediate_recall] 0.0155 *
11 Gamma [rest_closed, nb1] 0.0396 *
12 Gamma [rest_wonder, rest_closed] 0.0065 **
13 Gamma [statements, rest_closed] 0.0175 *
我正在try 通过Feature_name和amp;组合来达到p_val. 意思是-我想插入示例‘VC9’和[REST_CLOSED,IMMEDIATE_RECALL],并获得匹配的p_val. 我试过的一切都失败了... 这就是我现在所拥有的-
for feature in features:
for comb in combinations:
pval = df_sigs.loc[(df_sigs['feature_name'].isin([feature])) & (df_sigs['combo'].isin([comb])), df_sigs['p_val']]
我得到的错误是:
TypeError: unhashable type: 'list'
(我想在绘图上打印p_val,这样我只需要一个循环)
当我try 其他方法时,我也多次收到此错误:
ValueError: Lengths must match to compare
(例如,当我使用np.where时)
我认真地try 了我能想到的任何方法--创建另一列字符串列,将列表的两个元素结合在一起.取消列出,将列表转换为元组.我觉得我错过了一些非常基本的东西.