I'm trying to get the previous non-empty value of another column.
Sample of my data frame
Sample of my data frame
import pandas as pd
table = pd.DataFrame(data = {'CustName':['Customer A','','','Customer B','',''],
'Value':[1500,1400,9000,9000,9000,1600],
})I'm expecting a table like thisOutput: CustName CustNameNew Value
0 Customer A Customer A 1500
1 Customer A 1400
2 Customer A 9000
3 Customer B Customer B 9000
4 Customer B 9000
5 Customer B 1600Can someone help me to create "CustNameNew" column through a function using the previous non-empty value of "CustName"?
