weixin_53493752
jobs GO BIG OR GO HOME
采纳率66.7%
2021-02-28 22:59

python 的pandas和numpy无法调用

谢谢了

import pandas as pd

df1 = pd.read_excel(r'神奇公式数据.xlsx','2017',skiprows=4)

df2 = pd.read_excel(r'神奇公式数据.xlsx','2010',skiprows=4)

df = pd.concat([df1, df2],axis=1,keys=['2017','2010'],names=['来源表','行索引'])

# df.to_excel(r'神奇公式数据1111.xlsx', 'Sheet1')
print(df)

Traceback (most recent call last):

  File "zwj.py", line 1, in <module>

    import pandas as pd

  File "/Users/zhaowenju/opt/anaconda3/lib/python3.8/site-packages/pandas/__init__.py", line 11, in <module>

    __import__(dependency)

  File "/Users/zhaowenju/opt/anaconda3/lib/python3.8/site-packages/pytz/__init__.py", line 12, in <module>

    import datetime

  File "/Users/zhaowenju/opt/anaconda3/lib/python3.8/datetime.py", line 8, in <module>

    import math as _math

  File "/Users/zhaowenju/Desktop/math.py", line 1, in <module>

    import numpy as np

  File "/Users/zhaowenju/opt/anaconda3/lib/python3.8/site-packages/numpy/__init__.py", line 145, in <module>

    from . import core

  File "/Users/zhaowenju/opt/anaconda3/lib/python3.8/site-packages/numpy/core/__init__.py", line 22, in <module>

    from . import multiarray

  File "/Users/zhaowenju/opt/anaconda3/lib/python3.8/site-packages/numpy/core/multiarray.py", line 12, in <module>

    from . import overrides

  File "/Users/zhaowenju/opt/anaconda3/lib/python3.8/site-packages/numpy/core/overrides.py", line 7, in <module>

    from numpy.core._multiarray_umath import (

AttributeError: partially initialized module 'datetime' has no attribute 'datetime_CAPI' (most likely due to a circular import)

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • hjue 多鱼的夏天 1月前

    在命令行输入python,回车,然后输入 import pandas 试试

    点赞 1 评论 复制链接分享