Change variable.tolist() to variable = variable_tolist()