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 ')
 

 

 

第一次使用遇到报错:

ImportError: Unable to import required dependencies:
numpy:

Please note and check the following:

* The Python version is: Python3.7 from "F:\PY\python.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

posted @ 2022-04-25 22:35  黑白黑  阅读(171)  评论(0)    收藏  举报