Menu
CoddyTech

Recap: Ice Cream and Sun

Part of the Statistics for ML section of Coddy's Machine Learning journey. Lesson 34 of 64.

challenge icon

Challenge

Medium

Time for the grid of every relationship. A beach kiosk logged 40 days in kiosk.csv: a date and six number columns. The program reads one column name.

  1. Print the other column most strongly related to it, sign ignored.
  2. Print the strongest pair of different columns, checking each pair once, in table order.
  3. Draw the matrix as a coolwarm heatmap from -1 to 1 with a color bar, names as ticks, titled Kiosk Correlations.

Round both r to 2 decimals. For a smaller log and the input temp_c:

Most related to temp_c: ice_creams (r = 0.87)
Strongest pair: visitors and ice_creams (r = 0.96)

and the chart (Coddy then describes yours):

A 3 by 3 heatmap titled Kiosk Correlations with temp_c, visitors and ice_creams as tick labels, every cell a shade of red, visitors and ice_creams the deepest off the diagonal

Try it yourself

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

kiosk = pd.read_csv("kiosk.csv")
column = input()

# Write your code below

All lessons in Statistics for ML

Practice on your own: Online Python compiler