【已解决】报错:FutureWarning: Starting with pandas version 3.0 all arguments of to_excel except for the argument 'excel_writer' will be keyword-only.
pandas
库的在未来的 pandas
版本 3.0 中,to_excel
函数的参数(除了 excel_writer
参数之外)都将只能通过关键字参数的形式传递。即使用 to_excel
方法时,需要明确地指定每个参数的名称。
df.to_excel('output.xlsx', 'Sheet1', index=False)
在 pandas
3.0 及以后的版本中,应该改为:
df.to_excel('output.xlsx', sheet_name='Sheet1', index=False)