Recap: Cafe Sales
Part of the Data and Plots section of Coddy's Machine Learning journey. Lesson 51 of 60.
Challenge
MediumA cafe logged two weeks in cafe.csv: day, customers and sales (dollars). The till crashed on day 9, so its sales cell is empty.
- Fill the gap with the
salesmean. - Make two charts side by side with
plt.subplots(1, 2). - Left:
cafe.plotofcustomersagainstday, titledCustomers per Day, y labelCustomers. - Right: a histogram of
saleswithbins=4, titledDaily Sales, x labelSales ($), y labelDays.
Yours should look like this one, a bookshop's:
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
7pandas DataFrames
SeriesDataFramesReading CSV FilesInspecting DataSelecting ColumnsRecap: Movie Ratings10Plotting DataFrames
Plotting a DataFrameScatter from ColumnsOne Color per GroupHistogram of a ColumnRecap: Cafe Sales2NumPy Arrays
Creating ArraysShape and SizeRanges of NumbersIndexing and SlicingRecap: Temperature GridPractice on your own: Online Python compiler