Class 16, Wednesday, October 3
CSV Chrestomathics Déjà vu
CVS Drugstore — Is not to be examined — CSV files yes
Look both ways
Agenda
- CSV chrestomathics
Note
- Students with test accomodations must see me before they leave class.
Aesthetics
- Future criteria
Datasets de jeur
Name, Author, Language, Date, Sales
Don Quixote, de Cervantes, Spanish, 1605, 500000000
A Tale of Two Cities, Dickens, English, 1859, 200000000
The Lord of the Rings, Tolkien, English, 1954, 150000000
The Little Prince, de Saint-Exupery, French, 1943, 140000000
Harry Potter and the Philosopher's Stone, Rowling, English, 1997, 120000000
The Hobbit, Tolkien, English, 1937, 100000000
And Then There Were None, Christie, English, 1939, 100000000
Dream of the Red Chamber, Xueqin, Chinese, 1754, 100000000
Alice's Adventures in Wonderland, Carroll, English, 1865, 100000000
Location, Author, Max Height, Min Height
Narnia, Lewis, 4810, -10
Neverland, Milne, 426, -2
Oz, Baum, 1231, 679
Sleepy 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
...
Examples
- Presents the user-specified column of data from CSV dataset best-sellers.csv.
Two sample program runs
Enter column of interest: Language
Spanish
English
English
French
English
English
English
Chinese
English
Enter column of interest: sales
500000000
200000000
150000000
140000000
120000000
100000000
100000000
100000000
100000000
- analyze_dataset.py — for a user-specified dataset, and two user-specified column labels
column1
andcolumn2
:
- Determines the minimum value
min1
for thecolumn1
of the dataset
- Determines
min_label
— thecolumn2
value for the row whosecolumn1
value ismin1
- Prints labeled explanatory information about
min1
Three sample runs
Enter the name of a data set: elevations.csv
Enter a column label for the data set: Max Height
Enter a column label for the data set: Author
Min Max Height: 426
Author: Milne
Enter the name of a data set: countries.csv
Enter a column label for the data set: Males
Enter a column label for the data set: Country
Min Males: 101778
Country: Mayotte
Enter the name of a data set: best-sellers.csv
Enter a column label for the data set: Date
Enter a column label for the data set: Book
Min Date: 1605
Book: Don Quixote
To do
- Bring questions to class on Friday
- 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 course documentation for module random.
- Epistle on syntax errors and exceptions.
- Epistle on accomplishments.
Another dataset
Name,Type,Population,Male,Female,Households,Housing Units,Owner-occupied
Accomack,County,38305,18590,19715,15299,19550,11482
Albemarle,County,79236,38002,41234,31876,33720,20991
Alleghany,County,12926,6450,6476,5149,5812,4369
Amelia,County,11400,5622,5778,4240,4609,3474
Amherst,County,31894,15208,16686,11941,12958,9325
Appomattox,County,13705,6671,7034,5322,5828,4315
Arlington,County,189453,95443,94010,86352,90426,37370
Augusta,County,65615,32995,32620,24818,26738,20628
...
© 2019 Jim Cohoon | Resources from previous semesters are available. |