Skip to content

Commit 1c2bec6

Browse files
committed
Added a example for using Datasets::TLC::FHVTrip class
1 parent 4018e84 commit 1c2bec6

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

example/tlc-fhv-trip.rb

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env ruby
2+
3+
require "datasets-parquet"
4+
5+
trips = Datasets::TLC::FHVTrip.new(year: 2022, month: 1)
6+
7+
p trips.to_arrow
8+
#<Arrow::Table:0x11441f108 ptr=0x10775f960>
9+
# dispatching_base_num pickup_datetime dropOff_datetime PUlocationID DOlocationIDSR_Flag Affiliated_base_number
10+
# 0 B00009 2022-01-01T09:31:00+09:00 2022-01-01T10:05:00+09:00 (null) (null) (null) B00009
11+
# 1 B00009 2022-01-01T09:37:00+09:00 2022-01-01T10:05:00+09:00 (null) (null) (null) B00009
12+
# ...
13+
14+
trips.first(2).each do |trip|
15+
p [
16+
trip.dispatching_base_num,
17+
trip.pickup_datetime,
18+
trip.dropoff_datetime,
19+
trip.pu_location_id,
20+
trip.do_location_id,
21+
trip.sr_flag?,
22+
trip.affiliated_base_number
23+
]
24+
end
25+
# ["B00009", 2022-01-01 09:31:00 +0900, 2022-01-01 10:05:00 +0900, nil, nil, false, "B00009"]
26+
# ["B00009", 2022-01-01 09:37:00 +0900, 2022-01-01 10:05:00 +0900, nil, nil, false, "B00009"]
27+
# ...

0 commit comments

Comments
 (0)