0

I have a quick question, can someone tell me why this is not working? -.-"

The point is to look through a the column "Owned by Team" filter out all the unique teams and then input them as a drop down menu in Tkinter.

Unfortunately at the moment I am getting an empty list.

teams = [user for user in df['Owned By Team'] if user != user]

when I do it differently it does give me the one result but nothing else

#read data
excel = 'export.xlsx'
data = pd.read_excel(excel, parse_dates=['Closed Date Time'])
df = pd.DataFrame(data)

root = Tk()
root.title("Graph by Team")
root.geometry('400x200')

teams = [user for user in df['Owned By Team']]
team = list(set(teams))

clicked = StringVar()

# Drop Down Box
drop = OptionMenu(root, clicked, *team)
drop.pack()

newGraph = Button(root, text='Show graph', command=graph)
newGraph.pack()

print(team)

root.mainloop()
  • I think you missed something here. 'user != user' condition will always return empty – LazyClown Oct 25 '22 at 13:06
  • Well, I dont know how to do it so he checks if the "user" already exist. I am open to any suggestions. Thats why I posted the question – Keyt Weyner Oct 25 '22 at 13:08
  • Consider want the list of all the other users except for the one in `user`, you can do `teams = [usr for usr in df['Owned By Team'] if usr != user]` – LazyClown Oct 25 '22 at 13:12

0 Answers0