Is there any way I can refactor my code to avoid getting this warning?
A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead
# get the total number of users who paid off
paidOffTotaDataFrame = newDF.loc[(newDF.Loan_Status=='PAIDOFF')]
#create column paid off in X days
difference = newDF.Paid_Off_Time - newDF.Effective_Date
paidOffTotaDataFrame['Paid_Off_In_Days'] = difference
I also tried
paidOffTotaDataFrame.loc[:,'Paid_Off_In_Days'] = difference
print(paidOffTotaDataFrame.apply(lambda row: "paid off column " + str(row['Paid_Off_In_Days']), axis=1))