I am getting the below error:
**raise KeyError("{} not found in axis".format(labels[mask]))
KeyError: '[18] not found in axis'**
I am trying to drop rows based on conditions and my code is below:
PSE2=PSE1
for i in range(1,len(PSE1)):
if PSE1.iloc[[i],[1]].values==PSE1.iloc[[i+1],[1]].values or PSE1.iloc[[i],[1]].values==PSE1.iloc[[i-1],[1]].values:
pass
else:
print(str(i))
print(PSE2.iloc[[i],[1]].values)
PSE2=PSE2.drop([i],axis=0)
PSE1 and PSE2 are two identical Dataframes.