我有一个pandas数据框如下:
Sample_name C14-Cer_mean C16-Cer_mean C18-Cer_mean C18:1-Cer_mean
0 1 1 0.124749 0.285659 35.302029 8.173144
1 1 10 0.332976 0.656197 39.220933 6.446620
2 1 13 0.227423 0.272440 26.866943 5.763723
3 1 14 0.128359 0.604903 29.848169 6.801633
4 1 5 0.204000 0.242652 21.354158 4.637632
5 1 6 0.122697 0.412868 25.168258 5.866785
6 1 9 0.161679 0.569781 28.707720 6.525267
7 Blank 0.408713 0.526573 0.531430 0.111025
我想得到一个数据框,其中所有行中的值除以行中的值,Sample_name为“Blank”(规范化为示例“Blank”)。我怎样才能在熊猫中实现这一目标?
答案 0 :(得分:2)
您可以选择所有行并使用<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
<engine name="ios" spec="~3.9.2" />
对df进行切片,然后调用div
并使用phonegap create myApp --template jquery-mobile-starter
传递最后一行:
loc
答案 1 :(得分:1)
df.loc[:,'C14-Cer_mean':] = df.loc[:,'C14-Cer_mean':].div(df.iloc[-1]['C14-Cer_mean':])
Sample_name C14-Cer_mean C16-Cer_mean C18-Cer_mean C18:1-Cer_mean
0 1 1 0.305224 0.542487 66.4284 73.6153
1 1 10 0.814694 1.24617 73.8026 58.0646
2 1 13 0.556437 0.517383 50.5559 51.9137
3 1 14 0.314057 1.14875 56.1658 61.2622
4 1 5 0.499128 0.460814 40.1824 41.7711
5 1 6 0.300203 0.784066 47.3595 52.842
6 1 9 0.395581 1.08206 54.0198 58.773
7 Blank 1 1 1 1