From 1c2bec6d6e52bb663f504adfedc8ff058e366503 Mon Sep 17 00:00:00 2001 From: otegami Date: Wed, 2 Nov 2022 21:31:04 +0900 Subject: [PATCH] Added a example for using Datasets::TLC::FHVTrip class --- example/tlc-fhv-trip.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 example/tlc-fhv-trip.rb diff --git a/example/tlc-fhv-trip.rb b/example/tlc-fhv-trip.rb new file mode 100644 index 0000000..701a903 --- /dev/null +++ b/example/tlc-fhv-trip.rb @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby + +require "datasets-parquet" + +trips = Datasets::TLC::FHVTrip.new(year: 2022, month: 1) + +p trips.to_arrow +# +# dispatching_base_num pickup_datetime dropOff_datetime PUlocationID DOlocationIDSR_Flag Affiliated_base_number +# 0 B00009 2022-01-01T09:31:00+09:00 2022-01-01T10:05:00+09:00 (null) (null) (null) B00009 +# 1 B00009 2022-01-01T09:37:00+09:00 2022-01-01T10:05:00+09:00 (null) (null) (null) B00009 +# ... + +trips.first(2).each do |trip| + p [ + trip.dispatching_base_num, + trip.pickup_datetime, + trip.dropoff_datetime, + trip.pu_location_id, + trip.do_location_id, + trip.sr_flag?, + trip.affiliated_base_number + ] +end +# ["B00009", 2022-01-01 09:31:00 +0900, 2022-01-01 10:05:00 +0900, nil, nil, false, "B00009"] +# ["B00009", 2022-01-01 09:37:00 +0900, 2022-01-01 10:05:00 +0900, nil, nil, false, "B00009"] +# ...