df.columns = pd.MultiIndex.from_tuples(
zip(['AA ', 'BB ', '','DD', 'EE',''],df.columns))
我在脚本中使用了上面的代码,这就是为什么我必须设置index=True
df.to_excel(arg,index=True)
但现在我想放弃我的index column
我能做什么?
我试过了:df.reset_index(inplace=True) data.reset_index(drop=True, inplace=True) df.drop()
但没有人工作。。!
要删除索引列,请使用以下命令:
df = df.reset_index(drop=True)
导出到excel时,是否尝试将索引设置为"False"?
df.to_excel(arg,index=False)