When the conditional expression, c1 = 2017-04-01 holds, we want to substitute the number 300.0 for c3.
As a result, 300.0 is substituted for r3 and c3. However, the conditional expression is not r3 columns: c1 = 2017-04-01 is r3 to be organized, so it becomes the line.
import pandas as pd
df=pd.DataFrame(
[["2017-02-01",10.,100.],
["2017-03-01",20.,'Nan'],
["2017-04-01",30.,'Nan'],
["2017-05-01",40.,'Nan']],
index=['r1','r2','r3','r4'],
columns=['c1','c2','c3']
)
df
###########################
c1 c2 c3
r1 2017-02-01 10.0 100
r2 2017-03-01 20.0 Nan
r3 2017-04-01 30.0 Nan
r4 2017-05-01 40.0 Nan
What should I do?