这是代码......
import pandas as pd
import numpy as np
import requests
# x = ['~', 'A', 'Sun'] # Works
x = ['~', 'Walter', 'A', 'Sun'] # Doesn't work because of Walter
df = pd.DataFrame(x, columns=['x'])
u = "https://en.wikipedia.org/wiki/"
df['URL'] = u + df['x']
def tbl10(u):
html = requests.get(u).content
tbl = pd.read_html(u)[10]
return tbl
v = np.vectorize(tbl10)
pd.concat(v(df.URL))
谢谢!