Pandas 为什么我无法清理使用read\html属性提取的表?

Pandas 为什么我无法清理使用read\html属性提取的表?,pandas,Pandas,我期待着用read\uhtml属性提取一个表 route=pd.read_html(https://whatever.com,flavor='html5lib',thousands='.', decimal=',') 我对数组的第一个值感兴趣,该值显示如下表: route[1]:    Cambio de %    Volumen 0          NaN        NaN 1          NaN        NaN 2          NaN        NaN 3  

我期待着用
read\uhtml
属性提取一个表

route=pd.read_html(https://whatever.com,flavor='html5lib',thousands='.', decimal=',')
我对数组的第一个值感兴趣,该值显示如下表:

route[1]:

   Cambio de %    Volumen
0          NaN        NaN
1          NaN        NaN
2          NaN        NaN
3       -0,00%   136376.0
4          NaN        NaN
5       -0,02%    50941.0
6       -0,04%   152213.0
7       -0,07%   146387.0 
tabla_rdos=route[1]
tabla_rdos=route[1].dropna(inplace=True)
我想清理
NaN
行,因此我尝试了以下方法:

return (route[1]).dropna(inplace=True)
它返回一个
None

我试图将
路由[1]
存储在一个变量中,并按如下方式调用它:

route[1]:

   Cambio de %    Volumen
0          NaN        NaN
1          NaN        NaN
2          NaN        NaN
3       -0,00%   136376.0
4          NaN        NaN
5       -0,02%    50941.0
6       -0,04%   152213.0
7       -0,07%   146387.0 
tabla_rdos=route[1]
tabla_rdos=route[1].dropna(inplace=True)
答复:

 'NoneType' object has no attribute 'dropna'
然后我检查:

return: tabla_rdos
返回
None


我只想返回通过
read_html
获得的表,不带NaN值。我不明白为什么要这样挣扎。

你需要删除
inplace=True
,因为如果在pandas函数中
inplace=True
,它总是返回
None

return (ruta[1]).dropna()