I have a dataframe which contains orders from a restaurant, order ids and prices of each item from the order. One row is a name of the product with its price and order id. I would like to calculate the average of all orders, but hence the order may consist of multiple products they are in separate rows.
I was trying to define what an order is in python but since I'm a newbie, with no success.
for order in df:
n = 1
order = df.order_id == n
for order in orders:
orders.median()
n = n + 1
This is what the table looks like - as you can see the order id for the forst two items is the same:
order_id quantity item_name choice_description item_price
0 1 1 Chips and Fresh Tomato Salsa NaN 2.39
1 1 1 Izze [Clementine] 3.39
I have a problem with the syntax, I don't know how to express it in python language. Could you please help?
Thanks a lot!