Filter Pandas Data Frame
I have this pandas dataframe: open high low close volume TimeStamp 2016-06-23 10:00:00 586
Solution 1:
pandas' dataframe is base on index, so what you need is just
df.loc[(df['high']/df['low'])>5,'low']=df.avg
df
Out[1331]:
open high low close volume avg
0 586.76 594.00 585.54 589.94 478.176973 NaN
1 589.94 595.49 588.23 592.63 448.689485 585.54
2 592.63 592.63 588.23 581.13 527.816891 588.23
3 581.13 586.33 578.58 580.96 728.424757 1.50
Post a Comment for "Filter Pandas Data Frame"