I have 3 lists I created and I want to append them from the sql query output. I thought of created them as string as lst
and append the output but I get the error below.
list_A1 = []
list_A2 = []
list_A3 = []
for i, name in enumerate(dataset['name'][1]['price']):
.
.
.
id_list = pd.read_sql_query(q, con=db)[price].tolist()
lst = f"{lst_name}_{id}"
#lst created the 3 list above.
lst.append(id_list).astype(int)
Error : AttributeError: 'str' object has no attribute 'append'
Edit:
What I mean is on each loop lst
= list_A1..
and each of those lists gets populated with the data from the sql query