忽略矢量化中的错误

时间:2018-01-12 08:20:00

标签: python pandas

这是代码......

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))
  1. 如何让pd.concat忽略' Walter'?
  2. 有没有办法找出哪个元素导致错误 - 在被忽略之后?
  3. 谢谢!

0 个答案:

没有答案