Beginner here, I am trying to isolate the names of neighborhoods from a dataframe of Toronto based on a cluster value I've assigned them. Instead of a list of 3 unique items, I end up with a list 2363 items long.
Neigh_List = []
for n in toronto_merged['Cluster Labels']:
if n == 7 :
x = toronto_merged['Neighborhood']
Neigh_List.append(x) if x not in Neigh_List else None
Neigh_List
[0 Parkwoods
1 Parkwoods
2 Victoria Village
3 Victoria Village
4 Victoria Village
...
2359 Mimico NW , The Queensway West , South of Bloor , Kingsway Park South West , Royal York South West
2360 Mimico NW , The Queensway West , South of Bloor , Kingsway Park South West , Royal York South West
2361 Mimico NW , The Queensway West , South of Bloor , Kingsway Park South West , Royal York South West
2362 Mimico NW , The Queensway West , South of Bloor , Kingsway Park South West , Royal York South West
2363 Mimico NW , The Queensway West , South of Bloor , Kingsway Park South West , Royal York South West
Name: Neighborhood, Length: 2364, dtype: object]