Skip to content

Commit

Permalink
a3
Browse files Browse the repository at this point in the history
  • Loading branch information
Hninyeeko committed Nov 6, 2023
1 parent 9b980a8 commit 77a36e1
Show file tree
Hide file tree
Showing 12 changed files with 39,424 additions and 0 deletions.
16 changes: 16 additions & 0 deletions a3/a3.txt
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
19 changes: 19 additions & 0 deletions a3/a3t1.awk
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
}
}
25 changes: 25 additions & 0 deletions a3/a3t2.awk
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
}
26 changes: 26 additions & 0 deletions a3/a3t3.awk
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
}
}


207 changes: 207 additions & 0 deletions a3/a3t3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions a3/a3t4.awk
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
}
}

Loading

0 comments on commit 77a36e1

Please sign in to comment.