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
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
1 id first_name last_name email \
2 0 41874 Kyle Peck KylePeck71@gmail.com
3 1 31349 Elizabeth Velazquez EVelazquez1971@gmail.com
4 2 43416 Keith Saunders KS4047@gmail.com
5 3 56054 Ryan Sweeney RyanSweeney14@outlook.com
6 4 77402 Donna Blankenship DB3807@gmail.com
7 5 97148 Albert Dillon Albert.Dillon@gmail.com
8 6 19998 Judith Hewitt JudithHewitt98@gmail.com
9 7 83290 Kayla Hardin Kayla.Hardin@gmail.com
10 8 77867 Steven Blankenship Steven.Blankenship@gmail.com
11 9 54885 Carol Mclaughlin CM3415@gmail.com
12 1 35853 Jacob Juarez JJuarez1977@outlook.com
13 11 35916 Michael Christensen Michael.Christensen@gmail.com
14 12 39587 Dennis Vega Dennis.Vega@gmail.com
15 13 19234 Kathleen Frost KFrost1970@gmail.com
16 14 19733 Deborah Lara Deborah.Lara@gmail.com
17 15 30871 Abigail Dillard ADillard1994@gmail.com
18 16 11967 Maria Whitfield Maria.Whitfield@gmail.com
19 17 42371 Gregory Rose GRose1983@gmail.com
20 18 35693 Margaret Tyler MTyler1974@gmail.com
21 19 36694 Jessica Cash JCash1997@gmail.com
22 20 84933 Jeremy Holder JeremyHolder35@gmail.com
23 21 92283 Diana Burgess DBurgess1998@gmail.com
24 22 87240 William Calderon WilliamCalderon79@gmail.com
25 23 49817 Katherine Jensen Katherine.Jensen@gmail.com
26 24 18255 Tiffany Bradshaw TB6065@gmail.com
27 25 16026 William Edwards WE2364@gmail.com
28 26 39560 Teresa Valenzuela TValenzuela1973@gmail.com
29 27 63898 Amber Gross Amber.Gross@gmail.com
30 28 31777 Kayla Fox Kayla.Fox@yahoo.com
31 29 42232 Megan Tyson MTyson1979@gmail.com
32 .. ... ... ... ...
33 69 86546 Lisa Spence LSpence1998@gmail.com
34 70 55282 Noah Knox Noah.Knox@gmail.com
35 71 33364 Andrea Chang Andrea.Chang@yahoo.com
36 72 61294 Bobby Watkins BWatkins1975@outlook.com
37 73 83961 Stephen Hogan SHogan1990@gmail.com
38 74 56339 Lisa Mcfadden LisaMcfadden49@gmail.com
39 75 68675 Ruth Owen RO7614@gmail.com
40 76 68967 Sharon Franco SFranco1983@gmail.com
41 77 42304 Danielle Hawkins DH1551@gmail.com
42 78 57075 Jesse Foster JesseFoster77@gmail.com
43 79 97943 David Fuentes DFuentes1984@hotmail.com
44 80 93774 Rebecca Park RebeccaPark83@gmail.com
45 81 70164 Ann Greene Ann.Greene@gmail.com
46 82 24999 Paul Freeman PaulFreeman9@gmail.com
47 83 19127 Philip Dillard Philip.Dillard@gmail.com
48 84 67253 Amber Daugherty AmberDaugherty60@gmail.com
49 85 55075 Ashley Rogers Ashley.Rogers@hotmail.com
50 86 39447 Denise Mendoza DM2227@outlook.com
51 87 26805 Sean Richardson SR5213@gmail.com
52 88 35529 Carol Reilly CarolReilly18@gmail.com
53 89 49703 Paul Henderson Paul.Henderson@gmail.com
54 90 47183 Cynthia Duffy CDuffy1983@gmail.com
55 91 83778 Joe Perry JoePerry3@gmail.com
56 92 79139 Susan Cash SusanCash16@gmail.com
57 93 81591 Theresa Henderson THenderson1993@gmail.com
58 94 21506 Scott Deleon Scott.Deleon@gmail.com
59 95 77266 Zachary Gregory Zachary.Gregory@gmail.com
60 96 67264 Danielle Merrill DMerrill1998@gmail.com
61 97 19100 Danielle Barron DBarron1982@gmail.com
62 98 26210 Marilyn Finch MarilynFinch92@gmail.com
63 shoe_type shoe_material shoe_color price
64 0 ballet flats faux-leather black 385.0
65 1 boots fabric brown 388.0
66 2 sandles leather navy 346.0
67 3 sandles fabric brown 344.0
68 4 stilettos fabric brown 289.0
69 5 wedges fabric brown 266.0
70 6 stilettos leather black 395.0
71 7 stilettos leather white 241.0
72 8 wedges leather navy 266.0
73 9 ballet flats faux-leather brown 440.0
74 10 ballet flats leather red 331.0
75 11 ballet flats faux-leather red 270.0
76 12 ballet flats faux-leather brown 91.0
77 13 clogs leather brown 319.0
78 14 ballet flats leather white 205.0
79 15 ballet flats faux-leather white 278.0
80 16 wedges fabric white 180.0
81 17 boots faux-leather brown 319.0
82 18 ballet flats fabric brown 481.0
83 19 clogs leather red 397.0
84 20 wedges leather red 347.0
85 21 wedges faux-leather red 324.0
86 22 clogs leather red 439.0
87 23 boots fabric black 171.0
88 24 boots faux-leather navy 284.0
89 25 sandles leather white 326.0
90 26 clogs leather brown 323.0
91 27 stilettos leather black 451.0
92 28 sandles fabric navy 207.0
93 29 sandles faux-leather white 456.0
94 .. ... ... ... ...
95 69 wedges faux-leather black 115.0
96 70 ballet flats faux-leather white 308.0
97 71 ballet flats faux-leather white 106.0
98 72 sandles faux-leather brown 241.0
99 73 sandles faux-leather brown 113.0
100 74 clogs fabric black 221.0
101 75 clogs leather white 324.0
102 76 ballet flats fabric brown 124.0
103 77 sandles fabric navy 122.0
104 78 clogs fabric brown 234.0
105 79 clogs fabric black 242.0
106 80 ballet flats fabric black 226.0
107 81 stilettos fabric red 474.0
108 82 sandles fabric red 409.0
109 83 wedges faux-leather red 411.0
110 84 clogs faux-leather red 95.0
111 85 wedges faux-leather brown 269.0
112 86 clogs faux-leather brown 93.0
113 87 sandles fabric navy 339.0
114 88 wedges fabric brown 429.0
115 89 stilettos fabric red 430.0
116 90 clogs leather black 451.0
117 91 ballet flats leather white 196.0
118 92 sandles faux-leather red 185.0
119 93 stilettos leather white 342.0
120 94 stilettos fabric black 374.0
121 95 sandles leather red 216.0
122 96 wedges faux-leather red 461.0
123 97 sandles leather white 313.0
124 98 sandles leather black NaN
+8
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()