lib/red_amber/subframes.rb in red_amber-0.5.0 vs lib/red_amber/subframes.rb in red_amber-0.5.1

- old
+ new

@@ -1,9 +1,9 @@ # frozen_string_literal: true module RedAmber - # class SubFrames treats a set of subsets of a DataFrame + # class SubFrames treats subsets of a DataFrame # [Experimental feature] Class SubFrames may be removed or be changed in the future. class SubFrames include Enumerable # may change to use Forwardable. include Helper @@ -432,22 +432,22 @@ # @yieldreturn [Array] # aggregated values from the columns of passed dataframe. # @return [DataFrame] # created DataFrame. # @example Aggregate by key labels in arguments and values from block. - # subframes.aggregate(:y, :sum_x) { [y.first, x.sum] } + # subframes.aggregate(:y, :sum_x) { [y.one, x.sum] } # # # => # #<RedAmber::DataFrame : 3 x 2 Vectors, 0x0000000000003b24> # y sum_x # <string> <uint8> # 0 A 3 # 1 B 12 # 2 C 6 # # @example Aggregate by key labels in an Array and values from block. - # subframes.aggregate([:y, :sum_x]) { [y.first, x.sum] } + # subframes.aggregate([:y, :sum_x]) { [y.one, x.sum] } # # # => # #<RedAmber::DataFrame : 3 x 2 Vectors, 0x0000000000003b24> # y sum_x # <string> <uint8> @@ -455,11 +455,11 @@ # 1 B 12 # 2 C 6 # # @overload aggregate # - # Aggregate SubFrames creating DataFrame with pairs of key and aggregated value + # Aggregate SubFrames creating DataFrame with pairs of key and aggregated values # in Hash from the block. # # @yieldparam dataframe [DataFrame] # passes each dataframe in self to the block. Block is called by instance_eval, # so inside of the block is the context of passed dataframe. @@ -468,11 +468,11 @@ # Key names may be renamed to new label in the result. # @return [DataFrame] # created DataFrame. # @example Aggregate by key and value pairs from block. # subframes.aggregate do - # { y: y.first, sum_x: x.sum } + # { y: y.one, sum_x: x.sum } # end # # # => # #<RedAmber::DataFrame : 3 x 2 Vectors, 0x0000000000003b24> # y sum_x @@ -710,10 +710,10 @@ # @return [SubFrames] # a new SubFrames object with updated DataFrames. # @example # subframes.assign(:sum_x, :frac_x) do # group_sum = x.sum - # [[group_sum] * size, x / s.to_f] + # [[group_sum] * size, x / group_sum.to_f] # end # # # => # #<RedAmber::SubFrames : 0x000000000000fce4> # @baseframe=#<RedAmber::DataFrame : 6 x 5 Vectors, 0x000000000000fcf8>