我有以下列表:
['1',
'William Dunn Moseley',
'June 25, 1845–October 1, 1849(term limited)',
'Democratic',
'1845',
'Office did not exist',
'2',
'Thomas Brown',
'October 1, 1849–October 3, 1853(term limited)',
'Whig',
'1849',
'3',
'James E. Broome',
'October 3, 1853–October 5, 1857(term limited)',
'Democratic',
'1853',
]
列表中的每个数字对应于我要生成的数据集中的一行。因此,从这个列表中,id 想生成一个如下所示的数据集:
Number Name Term Party Election Office
1 'William Dunn Moseley' 'June 25, 1845–October 1, 1849(term limited)' Democratic 1845 'Office did not exist'
2 'Thomas Brown' 'October 1, 1849–October 3, 1853(term limited)' 'Whig' '1849' NA
3 'James E. Broome' 'October 3, 1853–October 5, 1857(term limited)' 'Democratic' '1853' NA
有没有一种简单的方法可以根据列表中的某些值(例如行号)将列表翻转为数据框?
您能提供的任何帮助将不胜感激!非常感谢。
森栏
qq_笑_17
泛舟湖上清波郎朗
人到中年有点甜
随时随地看视频慕课网APP
相关分类