目录
一、创建数据
import pandas as pd
data = pd.DataFrame([[2018, 75782, 19515, 21356, 34911],
[2019, 75447, 18652, 21234, 35561],
[2020, 75064, 17715, 21543, 35806],
[2021, 74652, 17072, 21712, 35868]], columns=['year', 'total_labour', 'prim_industry_employed', 'scd_industry_employed', 'tertiary_industry_employed'])
结果如下:
二、将特征列变成索引列
data_new=data.set_index('year',drop=True)