I'm trying to add a user input to a key in dictionary that is used as a dataframe but I can't seem to make it to work. Here's what I've done:
import pandas as pd
teams = {
"Team Ahab":["Venom","Quite"],
"Team Ishmael":[ "Big Boss","EVA"]}
team_df = pd.DataFrame(teams)
user_choice = input("What is your name:")
teams.update({"Team Ahab":user_choice})
team_reader = pd.read_csv("All Teams.txt")
When I try to print my dataframe the user input does not come up in the text file that I used since this comes up
Team Ahab,Team Ishmael, Team Miller, Team Ocelot
----------
Venom John Kaz Alex
I'm planning on updating the values on the dictionary with the user input(their names) into a key which is their chosen team. Here's what I want to look like
user_choice = input("What is your name:") ("Paul")
teams.update({"Team Ahab":user_choice})
print(team_df)
My ideal output:
Team Ahab ,Team Ishmael, Team Miller, Team Ocelot
Venom John Kaz Alex
Paul