-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
39,424 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Task 1: Top 10 Pickup Locations | ||
Average total amount, Pickup Location | ||
|
||
143.960000,221.0 | ||
95.841289,1.0 | ||
88.889515,265.0 | ||
87.170930,5.0 | ||
87.046667,156.0 | ||
74.492931,23.0 | ||
73.150000,99.0 | ||
70.700000,176.0 | ||
65.259412,118.0 | ||
62.048144,10.0 | ||
|
||
Task 2 | ||
Highest average total amount location pair: 138.015.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
!/bin/bash | ||
|
||
BEGIN { | ||
FS = "," | ||
} | ||
|
||
NR > 1 { | ||
loc = $8 | ||
total = $17 | ||
sum[loc] += total | ||
count[loc]++ | ||
} | ||
|
||
END { | ||
for (loc in sum) { | ||
avg = sum[loc] / count[loc] | ||
printf "%f,%s\n", avg, loc | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
!/bin/bash | ||
|
||
BEGIN{ | ||
FS = "," | ||
} | ||
NR > 1 { | ||
pickup = $8 | ||
dropoff = $9 | ||
total = $17 | ||
sum[pickup, dropoff] += total | ||
count[pickup, dropoff]++ | ||
} | ||
END{ | ||
max_avg = 0 | ||
max_pair = "" | ||
|
||
for (pair in sum) { | ||
avg = sum[pair] / count[pair] | ||
if ( avg > max_avg) { | ||
max_avg = avg | ||
max_pair = pair | ||
} | ||
} | ||
printf "Highest average total amount location pair: " max_pair, max_avg | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
!/bin/bash | ||
|
||
BEGIN { | ||
FS = "," | ||
OFS = "," | ||
} | ||
|
||
NR == 1 { | ||
next | ||
} | ||
|
||
$2 ~ /^"2019-08/ { | ||
passengers = $4 | ||
tip = $14 | ||
sum[passengers] += tip | ||
count[passengers]++ | ||
} | ||
|
||
END { | ||
for (passengers in sum){ | ||
avg = sum[passengers] / count[passengers] | ||
print passengers, avg | ||
} | ||
} | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
!/bin/bash | ||
|
||
BEGIN { | ||
FS = "," | ||
OFS = "," | ||
} | ||
|
||
NR == 1 { | ||
next | ||
} | ||
|
||
$2 ~ /^"2019-08/ { | ||
distance = $5 | ||
total = $17 | ||
sum[distance] += total | ||
count[distance]++ | ||
} | ||
|
||
END { | ||
for (distance in sum){ | ||
avg = sum[distance] / count[distance] | ||
print distance, avg | ||
} | ||
} | ||
|
Oops, something went wrong.