pandas 新增excel

发布时间:2022-06-08 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了pandas 新增excel脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
import pandas as pd
import numpy  as np
#赋值
df = pd.DataFrame({'ID':[1,2,3],'Name':['Tim','Victk','Nick']})
#重新设置索引
df = df.set_index('ID')
df.to_excel('F:/RF/output.xlsx')
print('OK ')
 

pandas 新增excel

 

 

第一次使用遇到报错:

ImportError: Unable to import required dependencies:numpy:

Please note and check the following:

* The Python version is: Python3.7 from "F:PYpython.exe" * The NumPy version is: "1.22.3"

and make sure that they are the versions you expect.Please carefully study the documentation linked above for further help.

Original error was: No module named 'numpy.core._multiarray_umath'

实际上有安装numpy,只不过版本不匹配。重新卸载numpy后安装

pip uninstall unmpy

pip install numpy

脚本宝典总结

以上是脚本宝典为你收集整理的pandas 新增excel全部内容,希望文章能够帮你解决pandas 新增excel所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: