Imagine you have the following df:
dffinalselection
description#1 description#2 lacheck taxrate#1
0 NaN NaN 5 Res
1 138.81 105.91 67 Rofus
12 74.16 4.34 55 Rennie
Now I would like to fill description#1 and #2 based on the values combined of lacheck / taxrate#1. This needs to be done iteratively and scalable because descriptions may be up to ten long.
So fabricated the following code.
dffinalselection['LineDescription'] = dffinalselection['lacheck'] + "-" + dffinalselection['taxrate#1']
filldescparty = dffinalselection.filter(like='description')
df[filldescparty].fillna(dffinalselection['LineDescription'], inplace = True)
dffinalselection.update(filldescparty)
However, getting the following error:
ValueError: Boolean array expected for the condition, not object
desired output:
description#1 description#2 lacheck taxrate#1
0 5 -Res 5 -Res 5 Res
1 67 - Res 67 - Res 67 Rofus
12 55 - Rennie 55 - Rennie 55 Rennie