How to extract the column in csv in python

I am using python and csv lib and Tkinter GUI

Column1    Column2
Test1      ID1
           ID2
           ID3
Test2      Act1
           ACT2
           ACT3

I want to show the column2 as per the Column1 Test no.
For example :SO Test1 is selected ID1 , ID2, ID3 should be shown and in next iteration When Test2 is selected Act1, Act2, Act3 is shown

What I tried:

with open('Test.csv') as f:
  listbox = tk.Listbox(self.root, width=162, height=200)
  listbox.place(x=10, y=50)
  reader = csv.DictReader(f, delimiter=',')
  for row in reader:
    adata1 = row['column1']
    adata2 = row['column2']

    if adata1 != adata1 or adata1 == "":
      listbox.insert('end', adata2)
    else:
      continue

Please if anyone can help me.

Answer

According to my understanding, the content of Test.csv file is something like:

column1,column2
Test1,ID1
,ID2
,ID3
Test2,ACT1
,ACT2
,ACT3

Then you can use a dictionary to store the CSV file content:

import csv

tests = {}
with open('Test.csv') as f:
    reader = csv.DictReader(f, delimiter=',')
    for row in reader:
        if row['column1']:
            key = row['column1']
            tests[key] = []
        tests[key].append(row['column2'])

And the result of tests will be:

{'Test1': ['ID1', 'ID2', 'ID3'], 'Test2': ['ACT1', 'ACT2', 'ACT3']}

And you can populate the required items into listbox based on your selected key:

listbox = tk.Listbox(self.root, width=162, height=200)
listbox.place(x=10, y=50)

...

key = 'Test1' # assume Test1 is selected as the key

listbox.delete(0, 'end')
for item in tests[key]:
    listbox.insert('end', item)