Python 将列拆分为多个列或单独的“;表格「;熊猫

Python 将列拆分为多个列或单独的“;表格「;熊猫,python,pandas,sorting,split,multiple-columns,Python,Pandas,Sorting,Split,Multiple Columns,我对python非常陌生,对自己在做什么一无所知。我有一系列数据描述了不同人群(“Leistung”的表现(“Leistung”)。每项性能还与特定值(“Taxpunke”)相关联。我想展示每个人的前十名表演,由表演的价值来定义 byleistung = df.groupby('Leistungserbringer') df2 = byleistung['Taxpunkte'].describe() df2.sort_values(['mean'], ascending=[False])

我对python非常陌生,对自己在做什么一无所知。我有一系列数据描述了不同人群(“Leistung”的表现(“Leistung”)。每项性能还与特定值(“Taxpunke”)相关联。我想展示每个人的前十名表演,由表演的价值来定义

byleistung = df.groupby('Leistungserbringer') 
df2 = byleistung['Taxpunkte'].describe()
df2.sort_values(['mean'], ascending=[False])

                count   mean        std         min     25%     50%     75%     max
Leistungserbringer      
Larsson William 6188.0  99.799108   231.765598  2.50    15.81   31.61   111.71  3909.72
Karlsson Oliwer 5645.0  93.344057   277.989424  3.61    15.81   31.61   94.83   9122.68
McGregor Sean   1250.0  89.100800   136.175528  3.61    18.35   34.78   111.71  998.64
Groeneveld Arno 4045.0  84.859498   202.230230  1.93    15.81   31.61   63.23   3323.52
Heepe Simon     3776.0  82.662950   359.970010  3.61    15.81   31.61   50.47   13597.60
Bitar Wahib     7814.0  72.190337   142.399537  3.61    15.81   31.61   61.75   3634.15
Cox James       4746.0  72.036013   132.240942  2.50    15.81   31.61   50.65   1664.40
Carvalho Tomas  7415.0  60.868030   156.889297  2.86    15.81   15.81   41.50   2099.20
“计数”是指特定人员的表演量。这些人总共表演了330场不同的节目。例如:

byleistung = df.groupby('Leistung') 
byleistung['Taxpktwert'].describe()

                                           count    unique  top     freq
Leistung                
'(+) %-Zuschlag für Notfall B, '              2       1     KVG     2
'+ Bronchoalveoläre Lavage (BAL)'             1       1     KVG     1
'+ Bürstenabstrich bei Bronchoskopie'         8       1     KVG     8
'+ Endobronchialer Ultraschall mit Punktion'  1       1     KVG     1
'XOLAIR Trockensub 150 mg c Solv Durchstf'    109     1     KVG     109
我的数据框如下所示(还有40000行):

我希望我的最终结果对每个人来说都是这样。排名应基于每项绩效计数的乘积(“Anzahl”)*价值(“Taxpunkte”):


我们将非常感谢您提供的任何方法提示或建议。

请查看pandas@VinceP谢谢@贾利克林格勒问题解决了?@KacperWolkowski我正在用
df.groupby('Leistungserbringer')['Leistung','Total Taxpkt',尝试,‌​'Anzahl'].head(10)
现在,但是人们的名字随着
.head()
消失了。如果它会显示我想象中的每一行的名字,这不是一个很好的格式。看看pandas@VinceP谢谢@贾利克林格勒问题解决了?@KacperWolkowski我正在用
df.groupby('Leistungserbringer')['Leistung','Total Taxpkt',尝试,‌​'Anzahl'].head(10)
现在,但是人们的名字随着
.head()
消失了。如果它会显示我想象的每一行的名称,这不是一个好的格式。
df.head()

Leistungserbringer  Anzahl  Leistung    AL      TL  Taxpktwert  Taxpunkte
0   Groeneveld Arno     12  'Beratung'  147.28  87.47   KVG     234.75
1   Groeneveld Arno     12  'Konsilium' 147.28  87.47   KVG     234.75
2   Groeneveld Arno     12  'Ultra'     147.28  87.47   KVG     234.75
3   Groeneveld Arno     12  'O2-Druck'  147.28  87.47   KVG     234.75
4   Groeneveld Arno     12  'Funktion'  147.28  87.47   KVG     234.75
Leistungserbringer    Leistung  Anzahl  Taxpunkte   Total Taxpkt    
Larsson William       1         x        a           x*a
                      2         y        b           y*b
                      .
                      .
                      10        z        c           z*c
...

McGregor Sean         1         x        a           x*a
                      2         y        b           y*b
                      .
                      .
                      10        z        c           z*b