pandas不显示index_大熊猫 - 不在索引中(pandas - not in index)

大熊猫 - 不在索引中(pandas - not in index)

我正在尝试替换列'A'中的nan值(第一行出现在第9行),前一个值是前一行

y = len(df)

for i in range(1,y):

if (np.isnan(df.ix[i,'A'])):

df.ix[i,'A'] = dfH.ix[i-1,'A']

给出错误

KeyError: "[9 'A'] not in index"

但是第9行A列显然在我的dataFrame中。 这里发生了什么?

I'm trying to replace the nan values in column 'A' (for which the first one appears in row 9) with the previous value is the row before

y = len(df)

for i in range(1,y):

if (np.isnan(df.ix[i,'A'])):

df.ix[i,'A'] = dfH.ix[i-1,'A']

gives the error

KeyError: "[9 'A'] not in index"

but row 9 column A is clearly in my dataFrame. What is going on here?

原文:https://stackoverflow.com/questions/39955687

更新时间:2019-09-04 16:02

你可能感兴趣的:(pandas不显示index)