简体   繁体   中英

Importing pandas gives an AttributeError 'module' object has no attribute 'partial'

import pandas as p

produces:

    Traceback (most recent call last):
  File "pandas_practice.py", line 1, in <module>
    import pandas as p
  File "/home/hellrider/.local/lib/python2.7/site-packages/pandas/__init__.py", line 13, in <module>
    __import__(dependency)
  File "/home/hellrider/.local/lib/python2.7/site-packages/numpy/__init__.py", line 142, in <module>
    from . import add_newdocs
  File "/home/hellrider/.local/lib/python2.7/site-packages/numpy/add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "/home/hellrider/.local/lib/python2.7/site-packages/numpy/lib/__init__.py", line 8, in <module>
    from .type_check import *
  File "/home/hellrider/.local/lib/python2.7/site-packages/numpy/lib/type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
  File "/home/hellrider/.local/lib/python2.7/site-packages/numpy/core/__init__.py", line 38, in <module>
    from . import numeric
  File "/home/hellrider/.local/lib/python2.7/site-packages/numpy/core/numeric.py", line 1820, in <module>
    from .arrayprint import array2string, get_printoptions, set_printoptions
  File "/home/hellrider/.local/lib/python2.7/site-packages/numpy/core/arrayprint.py", line 19, in <module>
    import functools
  File "/home/hellrider/Desktop/python-related/Some Scribbled Shit/functools.py", line 7, in <module>
    server_log = functools.partial(log, subsystem='server')
AttributeError: 'module' object has no attribute 'partial'

help me out here...pls

You should try by creating a __init__.py in the same level as functools.py

/home/hellrider/Desktop/python-related/Some Scribbled Shit/functools.py

Have you verified that functools has the "partial" function?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM