I am in the process of creating a 'random meal selector' from a number of recipe books. The objective is to use this to select what I have for dinner on each day of the week. I've created a dictionary for 'meals' that I've converted to a pandas df, and a list for 'days'. Here is a sample:
meals = {'Recipe': ['Chicken Kebab', 'Chicken Balti', 'Chicken Stir Fry', 'Chicken Curry', 'Cola Chicken', 'Chicken Fajita Pie',
'Chicken in Black Bean Sauce', 'Stuffed Meatballs', 'Pesto Pasta'],
'Book': ['1', '2', '1', '3', '1', '1', '3', '1', '1'],
'Page': ['48', '50', '52', '58', '72', '74', '80', '87', '108'],
'Category': ['Normal', 'Curry', 'Asian', 'Curry', 'Normal', 'Normal', 'Asian', 'Pasta', 'Pasta']}
df = pd.DataFrame(meals)
days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
What I'm looking to do, is randomly apply each element of the list to a new 'day' column in the dataframe, so it's selecting which recipe I make on each day. How would I go about doing this? Down the line I want to create some rules e.g. There can only be one Category 'Curry' selected, so any assistance with that would be great too! Quite new to Python so appreciate all the help you can provide.
Aucun commentaire:
Enregistrer un commentaire