Skip to content

Instantly share code, notes, and snippets.

@willthames
Last active February 27, 2019 07:58
Show Gist options
  • Save willthames/820dc4e250a83dd55bed05bcbf916d91 to your computer and use it in GitHub Desktop.
Save willthames/820dc4e250a83dd55bed05bcbf916d91 to your computer and use it in GitHub Desktop.
Austin Scooter trip stats
# YYYY/MM/DD TRIPS DEVICES TRIPS/DEVICE DURATION DURATION/TRIP
2019/01/01 7488 3240 2.31111 95470.9 12.7498
2019/01/02 988 711 1.38959 8022 8.11943
2019/01/03 5595 2645 2.11531 62385.7 11.1503
2019/01/04 9671 3612 2.67746 124206 12.8432
2019/01/05 13724 4319 3.17759 209968 15.2993
2019/01/06 9652 3629 2.65969 149453 15.4842
2019/01/07 8049 3289 2.44725 99603.7 12.3747
2019/01/08 8760 3465 2.52814 99411.2 11.3483
2019/01/09 8176 3305 2.47383 83849.4 10.2556
2019/01/10 8134 3209 2.53475 85032 10.4539
2019/01/11 8116 3136 2.58801 86083.2 10.6066
2019/01/12 14704 4448 3.30576 253395 17.233
2019/01/13 8632 3351 2.57595 136619 15.8271
2019/01/14 6283 2847 2.20688 77294.6 12.3022
2019/01/15 7039 2979 2.36287 63849 9.07075
2019/01/16 5951 2742 2.17031 51791.7 8.70302
2019/01/17 9642 3477 2.77308 103419 10.7258
2019/01/18 12038 4105 2.93252 131506 10.9243
2019/01/19 15162 4721 3.21161 185921 12.2623
2019/01/20 14658 4635 3.16246 188803 12.8805
2019/01/21 10366 3768 2.75106 121921 11.7616
2019/01/22 10859 3656 2.97019 89408.5 8.23359
2019/01/23 10463 3660 2.85874 78890.5 7.53995
2019/01/24 12275 4012 3.05957 97763 7.9644
2019/01/25 13819 4285 3.22497 126943 9.18609
2019/01/26 14917 4583 3.25485 184154 12.3453
2019/01/27 13873 4467 3.10566 175182 12.6275
2019/01/28 12086 4036 2.99455 94476.1 7.81699
2019/01/29 11601 3977 2.91702 76564.8 6.59985
2019/01/30 11387 3939 2.89084 76892.8 6.75268
2019/01/31 11515 3940 2.92259 82977.3 7.20602
2019/02/01 14558 4677 3.11268 125254 8.6038
2019/02/02 15684 4680 3.35128 181843 11.5942
2019/02/03 13655 4427 3.08448 156150 11.4354
2019/02/04 13205 4308 3.06523 110549 8.37177
2019/02/05 13444 4362 3.08207 107459 7.99311
2019/02/06 14045 4308 3.26021 111362 7.92895
2019/02/07 12558 4049 3.10151 92679.8 7.38014
2019/02/08 7585 3083 2.46027 51937 6.84733
2019/02/09 8229 3353 2.45422 75788.9 9.20998
2019/02/10 6414 2849 2.25132 59878.5 9.33559
2019/02/11 9216 3511 2.62489 72503.9 7.86717
2019/02/12 12900 4295 3.00349 99944.6 7.74764
2019/02/13 11703 4118 2.84191 88151.4 7.53237
2019/02/14 13818 4431 3.11848 114786 8.30701
2019/02/15 18506 4924 3.75833 202434 10.9388
2019/02/16 19116 4747 4.02696 225716 11.8077
2019/02/17 20300 4735 4.28722 253975 12.5111
2019/02/18 12372 4059 3.04804 124923 10.0973
2019/02/19 7112 2918 2.43729 48694.7 6.84683
2019/02/20 12658 4405 2.87355 104674 8.26939
2019/02/21 12594 4405 2.85902 97453.5 7.73809
2019/02/22 14372 4534 3.16983 129623 9.01914
2019/02/23 20350 5088 3.99961 262041 12.8767
2019/02/24 14148 4209 3.36137 178830 12.6399
2019/02/25 11191 4013 2.78869 97698.4 8.73009
2019/02/26 11719 4465 2.62464 89938.5 7.67459
2019/02/27 64 59 1.08475 327.017 5.10964
$ tail +2 ~/Downloads/Dockless_Vehicle_Trips.csv | awk -F, '
$3 == "scooter" {
date=sprintf("%s/%s/%s", substr($6,7,4), substr($6,1,2), substr($6,4,2));
tripcount[date]++; devicecount[date][$2]++; duration[date]+=$4;
}
END {
for (key in tripcount) {
print key, tripcount[key], length(devicecount[key]), tripcount[key]/length(devicecount[key]),
duration[key]/60, duration[key]/tripcount[key]/60
}
}' | sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment