Sha256: 19f3c96098e6350b69d63f7267e1e6c6441b1e72f6bcf140c48bbbf59d31de32

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 Bytes

Contents

require_relative 'all_jobs_shared'

class AggregateJob
  include AllJobsShared
  using Remi::Refinements::Daru

  define_source :source_data, Remi::DataSource::DataFrame
  define_target :target_data, Remi::DataTarget::DataFrame

  define_transform :main, sources: :source_data, targets: :target_data do

    mymin = lambda do |field, df, indicies|
      values = indicies.map { |idx| df.row[idx][field] }
      values.min
    end

    target_data.df = source_data.df.aggregate(by: :alpha, func: mymin.curry.(:year)).detach_index
    target_data.df.vectors = Daru::Index.new([:alpha, :year])
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
remi-0.2.4 lib/remi/project/jobs/aggregate_job.rb
remi-0.2.3 lib/remi/project/jobs/aggregate_job.rb