neesetifa / bert_classification

57 stars 18 forks source link

label_l_final.append(train.loc[k]['label']),AttributeError: 'function' object has no attribute 'loc' #3

Closed ZXXSG closed 7 months ago

ZXXSG commented 7 months ago

报错代码片段: train_l_final = [] label_l_final = [] for k in train_x.keys(): train_l_final.append(train_x[k]) label_l_final.append(train.loc[k]['label']) df_train = pd.DataFrame({'emb': train_l_final, 'label': label_l_final, }) df_train.head()

报错信息:

AttributeError Traceback (most recent call last) Cell In[53], line 5 3 for k in train_x.keys(): 4 train_l_final.append(train_x[k]) ----> 5 label_l_final.append(train.loc[k]['label']) 7 df_train = pd.DataFrame({'emb': train_l_final, 'label': label_l_final, }) 8 df_train.head()

AttributeError: 'function' object has no attribute 'loc'