Skip to content

Commit

Permalink
Added a example for using Datasets::TLC::FHVTrip class
Browse files Browse the repository at this point in the history
  • Loading branch information
otegami committed Nov 2, 2022
1 parent 4018e84 commit 1c2bec6
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions example/tlc-fhv-trip.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby

require "datasets-parquet"

trips = Datasets::TLC::FHVTrip.new(year: 2022, month: 1)

p trips.to_arrow
#<Arrow::Table:0x11441f108 ptr=0x10775f960>
# 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"]
# ...

0 comments on commit 1c2bec6

Please sign in to comment.