我正在尝试按值对数据框进行排序。收到 AttributeError:“Series”对象没有属性“to_numeric”。版本“0.20.3”,因此数字应该可以工作,但不行。请帮忙。
import pandas as pd
tables = pd.read_html("https://www.sec.gov/Archives/edgar/data/949012/000156761919015285/xslForm13F_X01/form13fInfoTable.xml")
len(tables)
ren=tables[3]
ren.drop(ren.index[[0,1,2]], inplace=True)
ren.to_numeric(ren[3], errors='coerce')
#ren[3].convert_objects(convert_numeric=True)
ren.sort_values(by=[3],ascending=False)
import pandas as pd
tables = pd.read_html("https://www.sec.gov/Archives/edgar/data/949012/000156761919015285/xslForm13F_X01/form13fInfoTable.xml")
len(tables)
ren=tables[3]
ren.drop(ren.index[[0,1,2]], inplace=True)
ren[3] = pd.to_numeric(ren[3], errors='coerce')
ren.sort_values([3],ascending=False, inplace=True)
ren
0 1 2 3 ...
101 JPMorgan COM 46625h100 48532 ...
44 Cisco COM 17275r102 47376 ...
204 Waste Management COM 94106L109 41558 ...
117 Microsoft COM 594918104 37492 ...
99 Johnson & Johnson COM 478160104 31491 ...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)