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
** Please excuse me if I described my current problem badly and this is because I recently started learning python and I dont really know the proper terminlogy that I need to use**
Anonymous Asked question May 13, 2021
Recent Comments