Python 删除多索引数据帧中具有重复索引的行

Python 删除多索引数据帧中具有重复索引的行,python,dataframe,multi-index,Python,Dataframe,Multi Index,我有以下带有双索引的数据帧。如何删除第一个索引等于第二个索引的行 First_index Second_index Column PitchAngle RotorSpeed -0.163742 GenSpeed PitchAngle -0.163689 GearboxBearingTemp PitchAn

我有以下带有双索引的数据帧。如何删除第一个索引等于第二个索引的行

First_index             Second_index          Column                          

PitchAngle              RotorSpeed         -0.163742
GenSpeed                PitchAngle         -0.163689
GearboxBearingTemp      PitchAngle         -0.063614                                              
GenSpeed                GenSpeed            0.325689
AmbientTemperature      AmbientTemperature  0.569469
WindDirection           WindDirection      -0.152658
请执行以下操作:

加载模块

import io
import pandas as pd
创建数据

df = pd.read_csv(io.StringIO("""
First_index             Second_index          Column                          
PitchAngle              RotorSpeed         -0.163742
GenSpeed                PitchAngle         -0.163689
GearboxBearingTemp      PitchAngle         -0.063614                                              
GenSpeed                GenSpeed            0.325689
AmbientTemperature      AmbientTemperature  0.569469
WindDirection           WindDirection      -0.152658
"""), sep="\s\s+", engine="python")
不要选择第一个索引等于第二个索引的行

df[~(df.First_index == df.Second_index)]

你真的是指删除行还是指调整第一个索引等于第二个的多索引?我的意思是删除行,所以我只想得到第一个索引和第二个索引不同的行