Task: Calculating Total Sales Revenue
Swipe to start coding
At Café Pandasia, the manager wants to calculate the total revenue for each coffee drink sold over three days.
You’ve been given the following DataFrame (df) tracking the sales for each coffee drink across three days (Monday to Wednesday).
| Coffee | Monday | Tuesday | Wednesday |
|---|---|---|---|
| Espresso | 45 | 38 | 50 |
| Latte | 60 | 65 | 62 |
| Cappuccino | 30 | 28 | 35 |
Additionally, you have the prices for each coffee drink stored in a separate DataFrame (prices):
| Coffee | Price |
|---|---|
| Espresso | 2.5 |
| Latte | 2.7 |
| Cappuccino | 3.0 |
- Add a new column "Total Revenue" to the original
dfby calculating the total revenue for each coffee drink. - The total revenue is the sum of the sales from Monday to Wednesday, multiplied by the price of the respective drink. For example, for Espresso, the total revenue will be
(45 + 38 + 50) x 2.5which is equal to332.5.
Note
The solution to this task is very similar to the previous one. The only diffierence is an additional multiplication. Recall how to multiply the corresponding values of two series, the same method applies to the dataframes.
Solución
¡Gracias por tus comentarios!
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Resumir este capítulo
Explicar el código en file
Explicar por qué file no resuelve la tarea
Awesome!
Completion rate improved to 2.7
Task: Calculating Total Sales Revenue
Desliza para mostrar el menú
Swipe to start coding
At Café Pandasia, the manager wants to calculate the total revenue for each coffee drink sold over three days.
You’ve been given the following DataFrame (df) tracking the sales for each coffee drink across three days (Monday to Wednesday).
| Coffee | Monday | Tuesday | Wednesday |
|---|---|---|---|
| Espresso | 45 | 38 | 50 |
| Latte | 60 | 65 | 62 |
| Cappuccino | 30 | 28 | 35 |
Additionally, you have the prices for each coffee drink stored in a separate DataFrame (prices):
| Coffee | Price |
|---|---|
| Espresso | 2.5 |
| Latte | 2.7 |
| Cappuccino | 3.0 |
- Add a new column "Total Revenue" to the original
dfby calculating the total revenue for each coffee drink. - The total revenue is the sum of the sales from Monday to Wednesday, multiplied by the price of the respective drink. For example, for Espresso, the total revenue will be
(45 + 38 + 50) x 2.5which is equal to332.5.
Note
The solution to this task is very similar to the previous one. The only diffierence is an additional multiplication. Recall how to multiply the corresponding values of two series, the same method applies to the dataframes.
Solución
¡Gracias por tus comentarios!
single