lundi 6 mai 2019

Using If statements with panda's dataframe

My program must do one of two things. If the user enter lucky it should output a randam sample from my database and not do anything else( I guess 'quit' the program. If they enter Custom it should output a list of genres from my data.

I have tried using sys.exit, quit, exit etc. When i use sys.exit I get the output I want but it is not in a dataframe...

start_search = input("Enter Lucky or Custom)

if start_search == "lucky":
     sys.exit(lucky_output(start_search)
elif start_search == "custom:
     genre_db 
else:
     print("Invalid Entry")

I also tried putting the function before sys.exit but it didn't print out anything. Help Please!

Aucun commentaire:

Enregistrer un commentaire