I have a following Pandas dataframe, where I want to change a value of 'fmc' column based on 'time', 'samples' and 'uid' columns.
Concept is as following:
For the same date, if df.samples == 'C' & df.uid == 'Plot1', then corresponding row value of fmc * 0.4
similarly for the same date, if df.samples == 'C' and df.uid == 'Plot2', then corresponding row value of fmc*0.8
For the same date, if df.samples == 'E' & df.uid == 'Plot1', then corresponding row value of fmc * 0.4
similarly for the same date, if df.samples == 'E' and df.uid == 'Plot2', then corresponding row value of fmc*0.15
For the same date, if df.samples == 'ns' & df.uid == 'Plot1', then corresponding row value of fmc * 0.2
similarly for the same date, if df.samples == 'ns' and df.uid == 'Plot2', then corresponding row value of fmc*0.05
I am new to python, so I apologize if I couldn't explain well and please let me know if you need more clarification.
time samples uid fmc
0 2015-10-11 C Plot1 98.226352
1 2015-10-11 C Plot2 132.984817
2 2015-10-11 E Plot1 114.147964
3 2015-10-11 E Plot2 110.083699
4 2015-10-11 ns Plot1 113.258977
5 2015-10-11 ns Plot2 113.768023
6 2015-10-19 C Plot1 118.503214
7 2015-10-19 E Plot1 108.733209
8 2015-10-19 ns Plot1 59.316977
9 2015-10-27 C Plot1 104.977531
10 2015-10-27 C Plot2 121.213887
11 2015-10-27 E Plot1 129.575670
12 2015-10-27 E Plot2 118.639048
13 2015-10-27 ns Plot1 103.581065
14 2015-10-27 ns Plot2 102.278469
15 2015-11-17 C Plot1 103.820689
16 2015-11-17 C Plot2 117.333382
17 2015-11-17 E Plot1 143.418932
18 2015-11-17 E Plot2 160.342155
19 2015-11-17 ns Plot1 89.890484