我正在从推文中提取功能,然后将其保存在Pandas DataFrame中,请参见此处:
for idx, tweet in tweets.iterrows():
data_frame.loc[idx, 'assertive_verbs_count'], \
data_frame.loc[idx, 'assertive_verb_tf'], \
data_frame.loc[idx, 'factive_verbs_count'], \
data_frame.loc[idx, 'factive_verb_tf'], \
data_frame.loc[idx, 'implicative_verbs_count'], \
data_frame.loc[idx, 'implicative_verb_tf'], \
data_frame.loc[idx, 'report_verbs_count'], \
data_frame.loc[idx, 'report_verb_tf'] = LF.bias_cues(idx, tweet)
data_frame.to_pickle('features_df' + '.pickle')
所有特征均已正确计算,并且data_frame中没有NaN值。我已经通过打印data_frame进行了检查。之后,我想使用pandas read_pickle()函数加载此DataFrame:
data_frame2 = pd.read_pickle('features_df' + '.pickle')
当我现在打印此“ data_frame2”时,它在某些地方返回NaN值。例如,当打印功能'implicative_verb_tf'时,它返回以下内容:
print(data_frame['implicative_verb_tf'].head(10))
0 True
1 NaN
2 False
3 NaN
4 True
5 NaN
6 NaN
7 False
8 False
9 NaN
有人知道这怎么可能吗?