Menu
CoddyTech

Recap: Cafe Sales

Part of the Data and Plots section of Coddy's Machine Learning journey. Lesson 51 of 60.

challenge icon

Challenge

Medium

A cafe logged two weeks in cafe.csv: day, customers and sales (dollars). The till crashed on day 9, so its sales cell is empty.

  1. Fill the gap with the sales mean.
  2. Make two charts side by side with plt.subplots(1, 2).
  3. Left: cafe.plot of customers against day, titled Customers per Day, y label Customers.
  4. Right: a histogram of sales with bins=4, titled Daily Sales, x label Sales ($), y label Days.

Yours should look like this one, a bookshop's:

Two charts side by side from a bookshop: a line titled Customers per Day over 14 days, and a histogram titled Daily Sales with 4 bars, x label Sales ($), y label Days

Your program prints nothing: Coddy checks the figure and describes it in the output.

Try it yourself

import pandas as pd
import matplotlib.pyplot as plt

cafe = pd.read_csv("cafe.csv")

# Write your code below

All lessons in Data and Plots

Practice on your own: Online Python compiler