In this program, the user may choose between three csv files. This is the gist of one of those three (let's call this as test_sample.csv):
CODE AGE GROUP SEX CITY
---- --------- --- ----
E101 25 to 29 M Denver
E102 25 to 29 F Denver
E103 45 to 49 M Chicago
E104 45 to 49 F Chicago
E105 25 to 29 M Denver
What I wish to happen is suppose the user inputs a city, the program will show the information about that place. For example, I input "Denver," the program will show:
CODE AGE GROUP SEX CITY
---- --------- --- ----
E101 25 to 29 M Denver
E102 25 to 29 F Denver
E105 25 to 29 M Denver
So far, I have only coded the first part (where the user chooses between the csv files). I have been stuck with the second part (showing specific information based on the city the user inputs), and I'm not sure what to do.
This is my code so far:
import pandas as pd
fileInput = str(input("Which file would you like to open: "))
fileOpen = open(fileInput)
df = pd.read_csv(fileOpen)
selectCity = input("Which city would you like to be visualized: ")
What should I do and where should I start?