dt = {'Ind':{0:‘Ind 1’,1:‘Ind 2’,2:‘Ind 3’,3:‘Ind 4’,4:‘Ind 5’,5:‘Ind 6’,6:‘Ind 7’,7:‘Ind 8’,8:‘Ind 9’,9:‘Ind 10’,10:‘Ind 1’,11:‘Ind 2’,12:‘Ind 3’,13:‘Ind 4’,14:‘Ind 5’,15:‘Ind 6’,16:‘Ind 7’,17:‘Ind8 8’,18:‘Ind8 9’,19:'Ind10'},‘治疗’:{0:‘治疗’,1:‘治疗’,2:‘治疗’,2:‘治疗’,3‘治疗’,4:‘治疗’,5‘治疗’,‘治疗’,6‘治疗’,7‘治疗’,8:‘治疗’,‘治疗’,9:‘治疗’,10:'Cont','Cont',12:'Cont',13:'Cont',14:“Cont”,15:“Cont”,16:“Cont”,17:“Cont”,18:“Cont”,19:“Cont”},“value”:{0: 4.5,1: 8.3,2: 6.2,3: 4.2,4: 7.1,5: 7.5,6: 7.9,7: 5.1,8: 5.8,9: 6.0,10: 11.3,11: 11.6,12: 13.3,13: 12.2,14: 13.4,15: 11.7,16: 12.1,17: 12.0,18: 14.0,19: 13.8}
mydt = pd.DataFrame(dt,列= ['Ind',‘处理’,‘值’)
我怎样才能整理我的数据,使它看起来像?
发布于 2022-07-12 22:58:11
您可以使用DataFrame.from_dict
pd.DataFrame.from_dict(data, orient='index')
https://stackoverflow.com/questions/72958999
复制相似问题