如下代码可将df的columns列作为索引列 df=df.set_index(['columns'],inplace=True) 转载于:https://www.cnblogs.com/feigebaqi/p/9772533.html