I have a function for running a logistic regression model. I would like to permanently save the dataframe generated within (cf) and amend it's name.
def model(ind, dep):
global cf
ind.fillna(0)
#some modelling code
#create confuson matix
cf = pd.DataFrame(confusion_matrix(y_train, y_pred))
cf.index = models
cf.columns = models
print(cf)
cf.plot.barh()
"cf_" + str(ind) = cf
return "cf_" + str(ind)
model(X_tv, y_combo)
model(X_tv_chan, y_combo)
I get this error
File "", line 64 "cf_" + str(ind) = coeff ^ SyntaxError: can't assign to operator
is there something wrong with how I am trying to create the dataframe?
"cf_" + str(ind) = cf