我正试图将this表转换为pandas
DataFrame
到目前为止我已经做了以下工作
import pandas as pd
url = 'http://www.scb.se/sv_/Hitta-statistik/Statistik-efter-amne/Befolkning/Befolkningens-sammansattning/Befolkningsstatistik/25788/25795/Helarsstatistik---Riket/26046/'
df = pd.read_html(url,thousands=' ')
df2= df[0]
我的问题是pandas
无法识别索引值0
是头。我还希望列值År
是索引值。
最后,我想把Folkmängd
列的值绘制成Y
,把År
列的值绘制成X
。
提前谢谢你。
这应该接近你想要的:
它应该会给你这样的东西:
相关问题 更多 >
编程相关推荐