I have the following code, but when I execute it, it prints the age_groups_list 17 times,
Any idea why?
import pandas as pd
file = pd.read_csv(r"file location")
age_groups_list = []
for var in file[1:]:
age = file.iloc[:, 10]
age_groups_list.append(age)
print(age_groups_list)
the idea is that I have a csv file with 16,000 (+) rows and 20 columns, I am picking the age group from index 10, adding it to a list and then print the list, however when printing the list, it does it for 17 time, this image shows the end of the printing output.
Any idea what am I doing wrong here?
thanks