#πŸ”’ Python pandas

9 messages Β· Page 1 of 1 (latest)

blissful trout
#

im doing a code and im kinda stuck on the pandas functions
this is my code for what im trying to do

def get_service():

    flag = True
    while flag:
        service_choice = input("What type of service would you like to select 'Lunch' or 'Dinner' ").upper()
        if service_choice == "LUNCH" or service_choice == "DINNER":
            flag = False
        else: 
            print("Not a valid option. Please try again")

    return service_choice
def get_product_choice():

    flag = True
    while flag:
        print("######################################################")
        print("Please choose a menu item form the list:")
        print("Please enter the number of the item (1-8)")
        print("1.  Nachos")
        print("2.  Soup")
        print("3.  Burger")
        print("4.  Brisket")
        print("5.  Ribs")
        print("6.  Corn")
        print("7.  Fries")
        print("8.  Salad")
        print("######################################################")

        menu_list = ["Nachos","Soup","Burger", "Brisket","Ribs","Corn", "Fries", "Salad"]

        item_choice = input("Please enter the number of your choice (1-8): ")
        try:
            item_choice = int(item_choice)
        except ValueError:
            print("Sorry, you did not enter a valid choice")
            flag = True
        else:
            if int(item_choice) < 1 or int(item_choice) > 8:
                print("Sorry, you did not enter a valid choice")
                flag = True
            else:
                item_name = menu_list[int(item_choice)-1]
                return item_name
elif main_menu == 2: 
    # service and food
    service = get_service()
    item = get_product_choice()

    df1 = pd.read_csv("Task4a_data.csv") ```

im trying to   "Show trends and patterns over time for lunch and dinner services" by making a dataframe which allows you to select which food and service type and it shows you on a dataframe
flat gustBOT
#

@blissful trout

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

blissful trout
#

im trying to make it so you select the food and the service type (lunch or dinner) and then it shows the food and service type you selected and the dates and amount sold that date

#

I have a test tmrw on this im cooked

willow goblet
blissful trout
flat gustBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.