Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Task: Calculating Total Sales Revenue | Basics of Dataframes
Pandas: First Steps
course content

Contenido del Curso

Pandas: First Steps

Pandas: First Steps

1. Getting Started
2. Basics of Dataframes

book
Task: Calculating Total Sales Revenue

Tarea

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).

CoffeeMondayTuesdayWednesday
Espresso453850
Latte606562
Cappuccino302835

Additionally, you have the prices for each coffee drink stored in a separate DataFrame (prices):

CoffeePrice
Espresso2.5
Latte2.7
Cappuccino3.0
  • Add a new column "Total Revenue" to the original df by 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.5 which is equal to 332.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

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 7
toggle bottom row

book
Task: Calculating Total Sales Revenue

Tarea

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).

CoffeeMondayTuesdayWednesday
Espresso453850
Latte606562
Cappuccino302835

Additionally, you have the prices for each coffee drink stored in a separate DataFrame (prices):

CoffeePrice
Espresso2.5
Latte2.7
Cappuccino3.0
  • Add a new column "Total Revenue" to the original df by 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.5 which is equal to 332.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

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 7
Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
Lamentamos que algo salió mal. ¿Qué pasó?
some-alt