Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在python3中将dict值元组拆分为df头和内容_Python_Python 3.x_Pandas_Dictionary - Fatal编程技术网

在python3中将dict值元组拆分为df头和内容

在python3中将dict值元组拆分为df头和内容,python,python-3.x,pandas,dictionary,Python,Python 3.x,Pandas,Dictionary,我有一本这样的字典: {'Customer A': {'key1':'value 1', 'fees': [[0, 0.26], [5, 0.24], [10, 0.22], [25, 0.2], [50, 0.18], [100, 0.16], [250, 0.14], [500, 0.12], [1000, 0.1]], 'key

我有一本这样的字典:

{'Customer A': {'key1':'value 1',
                'fees': [[0, 0.26], [5, 0.24], [10, 0.22], [25, 0.2],
                         [50, 0.18], [100, 0.16], [250, 0.14],
                         [500, 0.12], [1000, 0.1]],
                'key3':'value3'},
{'Customer B':...
             0     5    10    25    50   100   250   500   1000  
Customer A  0.26  0.24  0.22  0.2  0.18  0.16  0.14  0.12  0.1
Customer B
如何获得如下所示的“费用”df:

{'Customer A': {'key1':'value 1',
                'fees': [[0, 0.26], [5, 0.24], [10, 0.22], [25, 0.2],
                         [50, 0.18], [100, 0.16], [250, 0.14],
                         [500, 0.12], [1000, 0.1]],
                'key3':'value3'},
{'Customer B':...
             0     5    10    25    50   100   250   500   1000  
Customer A  0.26  0.24  0.22  0.2  0.18  0.16  0.14  0.12  0.1
Customer B
客户成为索引,值元组的第一部分成为标题


我们还在这里学习,所以非常感谢您的帮助。不幸的是,这感觉不像是基本的字典/列表/df操作…

使用
听写理解
,最后按以下方式对列进行排序:



完美的谢谢你,耶斯雷尔!如果客户没有“费用”值,如何避免出现错误?在这种情况下,理解迭代将进入下一步customer@ACF你能提出新问题吗?现在我离线,只打电话。谢谢。@jazrael新问题在这里: