Module: RedAmber::DataFrameIndexable
- Included in:
- DataFrame
- Defined in:
- lib/red_amber/data_frame_indexable.rb
Overview
mix-ins for the class DataFrame
Instance Method Summary collapse
-
#map_indices(*indices) ⇒ Object
Common method.
-
#sort(*sort_keys) ⇒ RedAmber::DataFrame
Sorted DataFrame.
-
#sort_indices(*sort_keys) ⇒ RedAmber::Vector
Sorted indices in Vector.
Instance Method Details
#map_indices(*indices) ⇒ Object
Common method
7 8 9 10 11 12 13 |
# File 'lib/red_amber/data_frame_indexable.rb', line 7 def map_indices(*indices) return self if indices.empty? indices = indices[0].data if indices[0].is_a?(Vector) new_dataframe_by(indices) end |
#sort(*sort_keys) ⇒ RedAmber::DataFrame
Returns Sorted DataFrame.
25 26 27 28 29 |
# File 'lib/red_amber/data_frame_indexable.rb', line 25 def sort(*sort_keys) indices = @table.sort_indices(sort_keys.flatten) new_dataframe_by(indices) end |
#sort_indices(*sort_keys) ⇒ RedAmber::Vector
Returns Sorted indices in Vector.
19 20 21 22 |
# File 'lib/red_amber/data_frame_indexable.rb', line 19 def sort_indices(*sort_keys) indices = @table.sort_indices(sort_keys.flatten) Vector.create(indices) end |