I am currently writing a function in pandas to try to check rows in a column to see if they are not null. If they are not null, I want something to be outputed to a new column and for this case it would be 'Financing'. Basically if a row has a value for loan funded date, I want the phrase Financing to be printed a new column called Payment Type.
def typepayment(x):
if x['Loan Funded Date'] != np.nan:
x['Payment Type'] = 'Financing'
return x
df2 = df1.apply(typepayment, axis = 1)
df2
The output for the code above still outputs Financing in Payment Type for rows that are null in Loan Funded Date. What is causing this problem?