Class 15, Monday, September 25
CSV Chrestomathics
TBD
Look both ways
Datasets de jeur
Location, Author, Max Height, Min Height
Narnia, Lewis, 4810, -10
Neverland, Milne, 426, -2
Oz, Baum, 1231, 679
Sleep Hollow, Irving, 1629, 304
Stars Hollow, Sherman-Palladino, 725, 152
Toyland, MacDonough, 6187, 0
Wonderland, Carroll, 5895, -5
Country, Females, Males, Continent
Afghanistan, 15160172, 16251571, Asia
Albania, 1599688, 1604596, Europe
Algeria, 17567864, 17900344, Africa
Angola, 9632075, 9449837, Africa
Argentina, 20643969, 19768407, South America
Armenia, 1652892, 1439180, Europe
Australia, 11175724, 11092660, Oceania
...
Agenda
- CSV chrestomathics
- Expanded url.py
Example
- analyze_dataset.py — for a user-specified dataset, and two user-specified column labels
column1
andcolumn2
:
- Determines the minimum value
min2
for thecolumn2
of the dataset
- Determines
min_label
— thecolumn1
value for the row whosecolumn2
value ismin2
- Prints labeled explanatory information about
min2
- Sample runs
Enter the name of a data set: elevations.csv
Enter a column label for the data set: Author
Enter a column label for the data set: Max Height
The min Max Height for the dataset is 426
It is in the row whose Author value is Milne
Enter the name of a data set: countries.csv
Enter a column label for the data set: Country
Enter a column label for the data set: Males
The min Males for the dataset is 101778
It is in the row whose Country value is Mayotte
To do
- Review class artifacts
- Review standard documentation for built-in functions.
- Review course documentation for module str.
- Review course documentation for module list.
- Review course documentation for local module url.
- Review standard documentation for module math.
- Review ccourse documentation for module random.
- Epistle on syntax errors and exceptions.
Another dataset
Type,Name,Population,Male,Female,Households,Total Housing Units,Owner-occupied
A,Accomack County,38305,18590,19715,15299,19550,11482
A,Albemarle County,79236,38002,41234,31876,33720,20991
A,Alleghany County,12926,6450,6476,5149,5812,4369
A,Amelia County,11400,5622,5778,4240,4609,3474
A,Amherst County,31894,15208,16686,11941,12958,9325
A,Appomattox County,13705,6671,7034,5322,5828,4315
A,Arlington County,189453,95443,94010,86352,90426,37370
A,Augusta County,65615,32995,32620,24818,26738,20628
...