Straight From the File

Data with PythonEasy+10 XP+10

Straight From the File

A running club exports its weekly results as a CSV file. The first line holds the column names, and every line after it is one runner, like this:

1runner,km,minutes
2Ana,5,27
3Ben,10,49

The starter code gives you write_text(path, text), which saves text into a file called path.

Task: write csv_overview(path, csv_text, column). It should:

  1. save csv_text into a file at path, using write_text
  2. load that file with pandas
  3. return a list of three things: the number of rows, the number of columns, and the largest value in the column named column

The header line is not a row. column always holds whole numbers.

Examples

path = "club_week1.csv"
csv_text = "runner,km,minutes\nAna,5,27\nBen,10,49\nCara,5,31\n"
column = "minutes"
returns [3, 3, 49]
path = "club_week2.csv"
csv_text = "runner,km,minutes\nAna,5,27\nBen,10,49\nCara,5,31\n"
column = "km"
returns [3, 3, 10]

Hints

Solve it to unlock the solution

Once your code passes every test, a reference solution shows up here so you can compare it with yours.

solution.py
CtrlEnterto run