Python——DataFrame、List、字典相互转换
list 列表转 Dataframe表
——创建新列a
1 | a = list(range(20)) |
——把a列表传入已有表data2
1 | import pandas as pd |
字典转Dataframe表
1 | data_set = [{ 'a' :['0',' 1', '2', '3' ,'4', '5'],'b':['s','d','f','g','h']}] |
嵌套列表转Dataframe表
1 | data_set = [[' 1', '2', '3' ,'4', '5'],['s','d','f','g','h']] |