错误ModuleNotFoundError:运行Python代码时没有名为“ api”的模块

时间:2019-06-20 20:59:59

标签: python-3.x

运行Python代码时遇到问题,即使我已经安装了模块pip-api,也遇到了回溯错误。

import pandas as pd
import requests
import target
import pip_api
from bs4 import BeautifulSoup

res = requests.get("http://web.archive.org/web/20070826230746/http://www.bbmf.co.uk/july07.html")
soup = BeautifulSoup(res.content,'lxml')
table = soup.find_all('table')[0]

df = pd.read_html(str(table))
df = df[1]
df = df.rename(columns=df.iloc[0])
df = df.iloc[2:]
df.head(15)

Southport = df[
    (
        df['Location'].str.contains('- Display') & 
        df['Lancaster'] == '' & 
        df['Dakota'] == 'D' & 
        df['Spitfire'] == 'S' & 
        df['Hurricane'] == 'H'
    )
] | df[
    (
        df['Location'].str.contains('- Display') & 
        df['Lancaster'] == '' & 
        df['Dakota'] == 'D' & 
        df['Spitfire'] == 'S' &
        df['Hurricane'] == ''
    )
] | df[
    (
        df['Location'].str.contains('- Display') & 
        df['Lancaster'] == '' & 
        df['Dakota'] == 'D' & 
        df['Spitfire'] == 'SS' &
        df['Hurricane'] == ''
    )
] 
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-1e8f3727cc23> in <module>
      1 import pandas as pd
      2 import requests
----> 3 import ops
      4 import target
      5 import api

c:\python37\lib\site-packages\ops\__init__.py in <module>
----> 1 from api import *
      2 from compound import *
      3 from target import *
      4 
      5 __all__ = ["api", "compound", "target"]

ModuleNotFoundError: No module named 'api'

以下线程说明了我的Python代码的目标:-

Python code line is too long and needs breaking up

任何帮助将不胜感激

Eddie

0 个答案:

没有答案