Class: Daru::Core::MergeFrame
Defined Under Namespace
Classes: NilSorter
Instance Method Summary collapse
-
#initialize(left_df, right_df, opts = {}) ⇒ MergeFrame
constructor
rubocop:disable Metrics/AbcSize – quick-fix for issue #171.
- #join ⇒ Object
Constructor Details
#initialize(left_df, right_df, opts = {}) ⇒ MergeFrame
rubocop:disable Metrics/AbcSize – quick-fix for issue #171
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/daru/core/merge.rb', line 20 def initialize left_df, right_df, opts={} # rubocop:disable Metrics/AbcSize -- quick-fix for issue #171 init_opts(opts) validate_on!(left_df, right_df) key_sanitizer = ->(h) { sanitize_merge_keys(h.values_at(*on)) } @left = df_to_a(left_df) @left.sort! { |a, b| safe_compare(a.values_at(*on), b.values_at(*on)) } @left_key_values = @left.map(&key_sanitizer) @right = df_to_a(right_df) @right.sort! { |a, b| safe_compare(a.values_at(*on), b.values_at(*on)) } @right_key_values = @right.map(&key_sanitizer) @left_keys, @right_keys = merge_keys(left_df, right_df, on) end |