import pandas as pd
wdl_standings = pd.read_html("http://doomleague.org", index_col=0)
standings_table = wdl_standings[0][["PTS", "PF", "PA"]]
print(standings_table)
打印出来:
PTS PF PA
Team
Techno Vikings 20 48 16
The Dream Team 15 41 26
Super Chargers 13 46 34
Giant Pea Shooters 10 34 33
Regulators 8 33 42
Sexual Panthers 4 22 35
Hurt You Plenty 4 23 34
High Friction Men 2 20 47
Process finished with exit code 0
表格是正确的。但是,我希望PTS,PF,PA列名称与<#34>同一行;#34; Team&#34;列名。我无法找到任何关于此的信息,任何帮助都会很棒!
答案 0 :(得分:0)
好像&#39; Team&#39;被计为元素,而不是列标题,也许
standings_table = wdl_standings[0][["Team","PTS", "PF", "PA"]]
会奏效吗?
答案 1 :(得分:0)
使用此命令对齐列名:
return [
'change_status' => 'required',
'forward_to' => 'required_if:change_status,2,3'
];