I want my dataframe to fill NaN in a column with other column values. But, my dataframe fills NaN with column name, not its values. It is strange. I have no idea. why.
df=
colA colB
2018-11-20 06:57:30 NaN 20.60646
2018-11-20 06:57:45 NaN 23.96100
2018-11-20 06:58:00 NaN 27.31554
2018-11-20 06:58:15 NaN 30.67008
2019-05-22 18:45:00 20.07324 20.76620
2019-05-22 18:45:15 19.92117 20.44672
2019-05-22 18:45:30 19.61703 20.12724
df['colA'].fillna('colB',inplace=True)
print(df)
df=
colA colB
2018-11-20 06:57:30 colB 20.60646
2018-11-20 06:57:45 colB 23.96100
2018-11-20 06:58:00 colB 27.31554
2018-11-20 06:58:15 colB 30.67008
2019-05-22 18:45:00 20.07324 20.76620
2019-05-22 18:45:15 19.92117 20.44672
2019-05-22 18:45:30 19.61703 20.12724
You need '.' operator or the column name as a string to the indexing operator.