new file: aggregates/orders.csv

new file:   aggregates/python.py
New exercise ... using pandas for aggregates
This commit is contained in:
Jonathan Ervine 2020-03-17 16:01:42 +08:00
parent 134952e8ee
commit ea143ef778
2 changed files with 133 additions and 0 deletions

125
aggregates/orders.csv Normal file
View File

@ -0,0 +1,125 @@
id,first_name last_name email \
0,41874 Kyle Peck KylePeck71@gmail.com
1,31349 Elizabeth Velazquez EVelazquez1971@gmail.com
2,43416 Keith Saunders KS4047@gmail.com
3,56054 Ryan Sweeney RyanSweeney14@outlook.com
4,77402 Donna Blankenship DB3807@gmail.com
5,97148 Albert Dillon Albert.Dillon@gmail.com
6,19998 Judith Hewitt JudithHewitt98@gmail.com
7,83290 Kayla Hardin Kayla.Hardin@gmail.com
8,77867 Steven Blankenship Steven.Blankenship@gmail.com
9,54885 Carol Mclaughlin CM3415@gmail.com
1,35853 Jacob Juarez JJuarez1977@outlook.com
11,35916 Michael Christensen Michael.Christensen@gmail.com
12,39587 Dennis Vega Dennis.Vega@gmail.com
13,19234 Kathleen Frost KFrost1970@gmail.com
14,19733 Deborah Lara Deborah.Lara@gmail.com
15,30871 Abigail Dillard ADillard1994@gmail.com
16,11967 Maria Whitfield Maria.Whitfield@gmail.com
17,42371 Gregory Rose GRose1983@gmail.com
18,35693 Margaret Tyler MTyler1974@gmail.com
19,36694 Jessica Cash JCash1997@gmail.com
20,84933 Jeremy Holder JeremyHolder35@gmail.com
21,92283 Diana Burgess DBurgess1998@gmail.com
22,87240 William Calderon WilliamCalderon79@gmail.com
23,49817 Katherine Jensen Katherine.Jensen@gmail.com
24,18255 Tiffany Bradshaw TB6065@gmail.com
25,16026 William Edwards WE2364@gmail.com
26,39560 Teresa Valenzuela TValenzuela1973@gmail.com
27,63898 Amber Gross Amber.Gross@gmail.com
28,31777 Kayla Fox Kayla.Fox@yahoo.com
29,42232 Megan Tyson MTyson1979@gmail.com
.., ... ... ... ...
69,86546 Lisa Spence LSpence1998@gmail.com
70 55282 Noah Knox Noah.Knox@gmail.com
71,33364 Andrea Chang Andrea.Chang@yahoo.com
72,61294 Bobby Watkins BWatkins1975@outlook.com
73,83961 Stephen Hogan SHogan1990@gmail.com
74,56339 Lisa Mcfadden LisaMcfadden49@gmail.com
75,68675 Ruth Owen RO7614@gmail.com
76,68967 Sharon Franco SFranco1983@gmail.com
77,42304 Danielle Hawkins DH1551@gmail.com
78,57075 Jesse Foster JesseFoster77@gmail.com
79 97943 David Fuentes DFuentes1984@hotmail.com
80 93774 Rebecca Park RebeccaPark83@gmail.com
81 70164 Ann Greene Ann.Greene@gmail.com
82 24999 Paul Freeman PaulFreeman9@gmail.com
83 19127 Philip Dillard Philip.Dillard@gmail.com
84 67253 Amber Daugherty AmberDaugherty60@gmail.com
85 55075 Ashley Rogers Ashley.Rogers@hotmail.com
86 39447 Denise Mendoza DM2227@outlook.com
87 26805 Sean Richardson SR5213@gmail.com
88 35529 Carol Reilly CarolReilly18@gmail.com
89 49703 Paul Henderson Paul.Henderson@gmail.com
90 47183 Cynthia Duffy CDuffy1983@gmail.com
91 83778 Joe Perry JoePerry3@gmail.com
92 79139 Susan Cash SusanCash16@gmail.com
93 81591 Theresa Henderson THenderson1993@gmail.com
94 21506 Scott Deleon Scott.Deleon@gmail.com
95 77266 Zachary Gregory Zachary.Gregory@gmail.com
96 67264 Danielle Merrill DMerrill1998@gmail.com
97 19100 Danielle Barron DBarron1982@gmail.com
98 26210 Marilyn Finch MarilynFinch92@gmail.com
shoe_type shoe_material shoe_color price
0 ballet flats faux-leather black 385.0
1 boots fabric brown 388.0
2 sandles leather navy 346.0
3 sandles fabric brown 344.0
4 stilettos fabric brown 289.0
5 wedges fabric brown 266.0
6 stilettos leather black 395.0
7 stilettos leather white 241.0
8 wedges leather navy 266.0
9 ballet flats faux-leather brown 440.0
10 ballet flats leather red 331.0
11 ballet flats faux-leather red 270.0
12 ballet flats faux-leather brown 91.0
13 clogs leather brown 319.0
14 ballet flats leather white 205.0
15 ballet flats faux-leather white 278.0
16 wedges fabric white 180.0
17 boots faux-leather brown 319.0
18 ballet flats fabric brown 481.0
19 clogs leather red 397.0
20 wedges leather red 347.0
21 wedges faux-leather red 324.0
22 clogs leather red 439.0
23 boots fabric black 171.0
24 boots faux-leather navy 284.0
25 sandles leather white 326.0
26 clogs leather brown 323.0
27 stilettos leather black 451.0
28 sandles fabric navy 207.0
29 sandles faux-leather white 456.0
.. ... ... ... ...
69 wedges faux-leather black 115.0
70 ballet flats faux-leather white 308.0
71 ballet flats faux-leather white 106.0
72 sandles faux-leather brown 241.0
73 sandles faux-leather brown 113.0
74 clogs fabric black 221.0
75 clogs leather white 324.0
76 ballet flats fabric brown 124.0
77 sandles fabric navy 122.0
78 clogs fabric brown 234.0
79 clogs fabric black 242.0
80 ballet flats fabric black 226.0
81 stilettos fabric red 474.0
82 sandles fabric red 409.0
83 wedges faux-leather red 411.0
84 clogs faux-leather red 95.0
85 wedges faux-leather brown 269.0
86 clogs faux-leather brown 93.0
87 sandles fabric navy 339.0
88 wedges fabric brown 429.0
89 stilettos fabric red 430.0
90 clogs leather black 451.0
91 ballet flats leather white 196.0
92 sandles faux-leather red 185.0
93 stilettos leather white 342.0
94 stilettos fabric black 374.0
95 sandles leather red 216.0
96 wedges faux-leather red 461.0
97 sandles leather white 313.0
98 sandles leather black NaN
Can't render this file because it has a wrong number of fields in line 34.

8
aggregates/python.py Normal file
View File

@ -0,0 +1,8 @@
import pandas as pd
orders = pd.read_csv('orders.csv')
print(orders.head(10))
most_expensive = orders.price.max()
num_colors = orders.shoe_color.nunique()