red_amber 0.5.0 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +75 -0
- data/.devcontainer/devcontainer.json +38 -0
- data/.devcontainer/onCreateCommand.sh +26 -0
- data/.rubocop.yml +3 -3
- data/CHANGELOG.md +102 -18
- data/Gemfile +1 -1
- data/README.ja.md +51 -32
- data/README.md +46 -30
- data/Rakefile +55 -0
- data/doc/DataFrame_Comparison.md +9 -13
- data/doc/DataFrame_Comparison_ja.md +61 -0
- data/doc/Dev_Containers.ja.md +290 -0
- data/doc/Dev_Containers.md +292 -0
- data/doc/qmd/examples_of_red_amber.qmd +4596 -0
- data/doc/qmd/red-amber.qmd +90 -0
- data/docker/Dockerfile +2 -2
- data/docker/Gemfile +1 -1
- data/docker/docker-compose.yml +1 -1
- data/docker/readme.md +5 -5
- data/lib/red_amber/data_frame_displayable.rb +1 -1
- data/lib/red_amber/data_frame_loadsave.rb +1 -1
- data/lib/red_amber/data_frame_selectable.rb +2 -2
- data/lib/red_amber/data_frame_variable_operation.rb +6 -6
- data/lib/red_amber/group.rb +287 -39
- data/lib/red_amber/subframes.rb +6 -6
- data/lib/red_amber/vector.rb +2 -1
- data/lib/red_amber/vector_selectable.rb +68 -35
- data/lib/red_amber/vector_string_function.rb +81 -13
- data/lib/red_amber/version.rb +1 -1
- data/red_amber.gemspec +3 -3
- metadata +15 -11
- data/docker/Gemfile.lock +0 -118
- data/docker/example +0 -86
- data/docker/notebook/examples_of_red_amber.ipynb +0 -8562
- data/docker/notebook/red-amber.ipynb +0 -188
| @@ -242,14 +242,20 @@ module RedAmber | |
| 242 242 | 
             
                  take(sort_indices(order: order))
         | 
| 243 243 | 
             
                end
         | 
| 244 244 |  | 
| 245 | 
            -
                # Returns  | 
| 245 | 
            +
                # Returns 1-based numerical rank of self.
         | 
| 246 246 | 
             
                # - Nil values are considered greater than any value.
         | 
| 247 247 | 
             
                # - NaN values are considered greater than any value but smaller than nil values.
         | 
| 248 | 
            +
                # - Order of each element is considered as ascending by default. It is
         | 
| 249 | 
            +
                #   changable by the parameter `order = :descending`.
         | 
| 248 250 | 
             
                # - Tiebreakers are ranked in order of appearance by default or
         | 
| 249 251 | 
             
                #   with `tie: :first` option.
         | 
| 250 | 
            -
                # -  | 
| 251 | 
            -
                #   This  | 
| 252 | 
            +
                # - Null values (nil and NaN) are placed at end by default.
         | 
| 253 | 
            +
                #   This behavior can be changed by the option `null_placement: :at_start`.
         | 
| 252 254 | 
             
                #
         | 
| 255 | 
            +
                # @param order [:ascending, '+', :descending, '-']
         | 
| 256 | 
            +
                #   the order of the elements should be ranked in.
         | 
| 257 | 
            +
                #   - :ascending or '+' : rank is computed in ascending order.
         | 
| 258 | 
            +
                #   - :descending or '-' : rank is computed in descending order.
         | 
| 253 259 | 
             
                # @param tie [:first, :min, :max, :dense]
         | 
| 254 260 | 
             
                #   configure how ties between equal values are handled.
         | 
| 255 261 | 
             
                #   - first: Ranks are assigned in order of when ties appear in the input.
         | 
| @@ -257,66 +263,93 @@ module RedAmber | |
| 257 263 | 
             
                #   - max: Ties get the largest possible rank in the sorted order.
         | 
| 258 264 | 
             
                #   - dense: The ranks span a dense [1, M] interval where M is the number
         | 
| 259 265 | 
             
                #     of distinct values in the input.
         | 
| 266 | 
            +
                # @param null_placement [:at_end, :at_start]
         | 
| 267 | 
            +
                #   configure the position of nulls to be located.
         | 
| 268 | 
            +
                #   Nulls are considered as `NaN < nil`.
         | 
| 260 269 | 
             
                # @return [Vector]
         | 
| 261 | 
            -
                #    | 
| 270 | 
            +
                #   1-based rank in uint64 of self (1..size in range) at maximum.
         | 
| 262 271 | 
             
                # @example Rank of float Vector
         | 
| 263 | 
            -
                #    | 
| 272 | 
            +
                #   float = Vector[1, 0, nil, Float::NAN, Float::INFINITY, -Float::INFINITY, 3, 2]
         | 
| 273 | 
            +
                #   float
         | 
| 264 274 | 
             
                #
         | 
| 265 275 | 
             
                #   # =>
         | 
| 266 | 
            -
                #   #<RedAmber::Vector(:double, size= | 
| 267 | 
            -
                #   [0. | 
| 276 | 
            +
                #   #<RedAmber::Vector(:double, size=8):0x0000000000036858>
         | 
| 277 | 
            +
                #   [1.0, 0.0, nil, NaN, Infinity, -Infinity, 3.0, 2.0]
         | 
| 268 278 | 
             
                #
         | 
| 269 | 
            -
                #    | 
| 279 | 
            +
                #   float.rank
         | 
| 280 | 
            +
                #   # or float.rank(:ascending, tie: :first, null_placement: :at_end)
         | 
| 270 281 | 
             
                #
         | 
| 271 282 | 
             
                #   # =>
         | 
| 272 | 
            -
                #   #<RedAmber::Vector(:uint64, size= | 
| 273 | 
            -
                #   [ | 
| 283 | 
            +
                #   #<RedAmber::Vector(:uint64, size=8):0x000000000003af84>
         | 
| 284 | 
            +
                #   [3, 2, 8, 7, 6, 1, 5, 4]
         | 
| 274 285 | 
             
                #
         | 
| 275 286 | 
             
                # @example Rank of string Vector
         | 
| 276 | 
            -
                #    | 
| 287 | 
            +
                #   string = Vector["A", "A", nil, nil, "C", "B"]
         | 
| 288 | 
            +
                #   string
         | 
| 277 289 | 
             
                #
         | 
| 278 290 | 
             
                #   # =>
         | 
| 279 | 
            -
                #   #<RedAmber::Vector(:string, size= | 
| 280 | 
            -
                #   ["A", " | 
| 291 | 
            +
                #   #<RedAmber::Vector(:string, size=6):0x000000000003d568>
         | 
| 292 | 
            +
                #   ["A", "A", nil, nil, "C", "B"]
         | 
| 281 293 | 
             
                #
         | 
| 282 | 
            -
                #    | 
| 294 | 
            +
                #   string.rank
         | 
| 283 295 | 
             
                #
         | 
| 284 296 | 
             
                #   # =>
         | 
| 285 | 
            -
                #   #<RedAmber::Vector(:uint64, size= | 
| 286 | 
            -
                #   [ | 
| 297 | 
            +
                #   #<RedAmber::Vector(:uint64, size=6):0x0000000000049bc4>
         | 
| 298 | 
            +
                #   [1, 2, 5, 6, 4, 3]
         | 
| 287 299 | 
             
                #
         | 
| 288 | 
            -
                # @example Rank  | 
| 289 | 
            -
                #    | 
| 300 | 
            +
                # @example Rank with order = :descending
         | 
| 301 | 
            +
                #   float.rank(:descending) # or float.rank('-')
         | 
| 290 302 | 
             
                #
         | 
| 291 303 | 
             
                #   # =>
         | 
| 292 | 
            -
                #   #<RedAmber::Vector(:uint64, size= | 
| 293 | 
            -
                #   [ | 
| 304 | 
            +
                #   #<RedAmber::Vector(:uint64, size=8):0x000000000006ef00>
         | 
| 305 | 
            +
                #   [4, 5, 8, 7, 1, 6, 2, 3]
         | 
| 294 306 | 
             
                #
         | 
| 295 | 
            -
                # @example Rank  | 
| 296 | 
            -
                #    | 
| 307 | 
            +
                # @example Rank with tie: :min
         | 
| 308 | 
            +
                #   string.rank(tie: :min)
         | 
| 297 309 | 
             
                #
         | 
| 298 310 | 
             
                #   # =>
         | 
| 299 | 
            -
                #   #<RedAmber::Vector(:uint64, size= | 
| 300 | 
            -
                #   [1,  | 
| 311 | 
            +
                #   #<RedAmber::Vector(:uint64, size=6):0x000000000007a1d4>
         | 
| 312 | 
            +
                #   [1, 1, 5, 5, 4, 3]
         | 
| 301 313 | 
             
                #
         | 
| 302 | 
            -
                # @example Rank  | 
| 303 | 
            -
                #    | 
| 314 | 
            +
                # @example Rank with tie: :max
         | 
| 315 | 
            +
                #   string.rank(tie: :max)
         | 
| 304 316 | 
             
                #
         | 
| 305 317 | 
             
                #   # =>
         | 
| 306 | 
            -
                #   #<RedAmber::Vector(:uint64, size= | 
| 307 | 
            -
                #   [ | 
| 318 | 
            +
                #   #<RedAmber::Vector(:uint64, size=6):0x000000000007cba0>
         | 
| 319 | 
            +
                #   [2, 2, 6, 6, 4, 3]
         | 
| 320 | 
            +
                #
         | 
| 321 | 
            +
                # @example Rank with tie: :dense
         | 
| 322 | 
            +
                #   string.rank(tie: :dense)
         | 
| 323 | 
            +
                #
         | 
| 324 | 
            +
                #   # =>
         | 
| 325 | 
            +
                #   #<RedAmber::Vector(:uint64, size=6):0x0000000000080930>
         | 
| 326 | 
            +
                #   [1, 1, 4, 4, 3, 2]
         | 
| 327 | 
            +
                #
         | 
| 328 | 
            +
                # @example Rank with null_placement: :at_start
         | 
| 329 | 
            +
                #   float.rank(null_placement: :at_start)
         | 
| 330 | 
            +
                #
         | 
| 331 | 
            +
                #   # =>
         | 
| 332 | 
            +
                #   #<RedAmber::Vector(:uint64, size=8):0x0000000000082104>
         | 
| 333 | 
            +
                #   [5, 4, 1, 2, 8, 3, 7, 6]
         | 
| 308 334 | 
             
                #
         | 
| 309 335 | 
             
                # @since 0.4.0
         | 
| 310 336 | 
             
                #
         | 
| 311 | 
            -
                def rank(tie: :first)
         | 
| 312 | 
            -
                   | 
| 313 | 
            -
             | 
| 314 | 
            -
             | 
| 315 | 
            -
             | 
| 337 | 
            +
                def rank(order = :ascending, tie: :first, null_placement: :at_end)
         | 
| 338 | 
            +
                  func = find(:rank)
         | 
| 339 | 
            +
                  options = func.default_options
         | 
| 340 | 
            +
                  order =
         | 
| 341 | 
            +
                    case order.to_sym
         | 
| 342 | 
            +
                    when :+, :ascending, :increasing
         | 
| 343 | 
            +
                      :ascending
         | 
| 344 | 
            +
                    when :-, :descending, :decreasing
         | 
| 345 | 
            +
                      :descending
         | 
| 316 346 | 
             
                    else
         | 
| 317 | 
            -
                       | 
| 347 | 
            +
                      raise VectorArgumentError, "illegal order option: #{order}"
         | 
| 318 348 | 
             
                    end
         | 
| 319 | 
            -
                   | 
| 349 | 
            +
                  options.sort_keys = [Arrow::SortKey.resolve('', order)]
         | 
| 350 | 
            +
                  options.tiebreaker = tie
         | 
| 351 | 
            +
                  options.null_placement = null_placement
         | 
| 352 | 
            +
                  Vector.create(func.execute([data], options).value)
         | 
| 320 353 | 
             
                end
         | 
| 321 354 |  | 
| 322 355 | 
             
                # Pick up elements at random.
         | 
| @@ -9,7 +9,7 @@ module RedAmber | |
| 9 9 |  | 
| 10 10 | 
             
                # For each string in self, emit true if it contains a given pattern.
         | 
| 11 11 | 
             
                #
         | 
| 12 | 
            -
                # @overload match_substring | 
| 12 | 
            +
                # @overload match_substring(string, ignore_case: nil)
         | 
| 13 13 | 
             
                #   Emit true if it contains `string`.
         | 
| 14 14 | 
             
                #
         | 
| 15 15 | 
             
                #   @param string [String]
         | 
| @@ -21,12 +21,12 @@ module RedAmber | |
| 21 21 | 
             
                #     nil inputs emit nil.
         | 
| 22 22 | 
             
                #   @example Match with string.
         | 
| 23 23 | 
             
                #     vector = Vector.new('array', 'Arrow', 'carrot', nil, 'window')
         | 
| 24 | 
            -
                #     vector.match_substring | 
| 24 | 
            +
                #     vector.match_substring('arr')
         | 
| 25 25 | 
             
                #     # =>
         | 
| 26 26 | 
             
                #     #<RedAmber::Vector(:boolean, size=5):0x000000000005a208>
         | 
| 27 27 | 
             
                #     [true, false, true, nil, false]
         | 
| 28 28 | 
             
                #
         | 
| 29 | 
            -
                # @overload match_substring | 
| 29 | 
            +
                # @overload match_substring(regexp, ignore_case: nil)
         | 
| 30 30 | 
             
                #   Emit true if it contains substring matching with `regexp`.
         | 
| 31 31 | 
             
                #   It calls `match_substring_regex` in Arrow compute function and
         | 
| 32 32 | 
             
                #   uses re2 library.
         | 
| @@ -41,14 +41,14 @@ module RedAmber | |
| 41 41 | 
             
                #     boolean Vector to show if elements contain a given pattern.
         | 
| 42 42 | 
             
                #     nil inputs emit nil.
         | 
| 43 43 | 
             
                #   @example Match with regexp.
         | 
| 44 | 
            -
                #     vector.match_substring | 
| 44 | 
            +
                #     vector.match_substring(/arr/)
         | 
| 45 45 | 
             
                #     # =>
         | 
| 46 46 | 
             
                #     #<RedAmber::Vector(:boolean, size=5):0x0000000000014b68>
         | 
| 47 47 | 
             
                #     [true, false, true, nil, false]
         | 
| 48 48 | 
             
                #
         | 
| 49 49 | 
             
                # @since 0.5.0
         | 
| 50 50 | 
             
                #
         | 
| 51 | 
            -
                def match_substring | 
| 51 | 
            +
                def match_substring(pattern, ignore_case: nil)
         | 
| 52 52 | 
             
                  options = Arrow::MatchSubstringOptions.new
         | 
| 53 53 | 
             
                  datum =
         | 
| 54 54 | 
             
                    case pattern
         | 
| @@ -67,6 +67,7 @@ module RedAmber | |
| 67 67 | 
             
                    end
         | 
| 68 68 | 
             
                  Vector.create(datum.value)
         | 
| 69 69 | 
             
                end
         | 
| 70 | 
            +
                alias_method :match_substring?, :match_substring
         | 
| 70 71 |  | 
| 71 72 | 
             
                # Check if elements in self end with a literal pattern.
         | 
| 72 73 | 
             
                #
         | 
| @@ -79,19 +80,20 @@ module RedAmber | |
| 79 80 | 
             
                #   nil inputs emit nil.
         | 
| 80 81 | 
             
                # @example Check if end with?.
         | 
| 81 82 | 
             
                #   vector = Vector.new('array', 'Arrow', 'carrot', nil, 'window')
         | 
| 82 | 
            -
                #   vector.end_with | 
| 83 | 
            +
                #   vector.end_with('ow')
         | 
| 83 84 | 
             
                #   # =>
         | 
| 84 85 | 
             
                #   #<RedAmber::Vector(:boolean, size=5):0x00000000000108ec>
         | 
| 85 86 | 
             
                #   [false, true, false, nil, true]
         | 
| 86 87 | 
             
                # @since 0.5.0
         | 
| 87 88 | 
             
                #
         | 
| 88 | 
            -
                def end_with | 
| 89 | 
            +
                def end_with(string, ignore_case: nil)
         | 
| 89 90 | 
             
                  options = Arrow::MatchSubstringOptions.new
         | 
| 90 91 | 
             
                  options.ignore_case = (ignore_case || false)
         | 
| 91 92 | 
             
                  options.pattern = string
         | 
| 92 93 | 
             
                  datum = find(:ends_with).execute([data], options)
         | 
| 93 94 | 
             
                  Vector.create(datum.value)
         | 
| 94 95 | 
             
                end
         | 
| 96 | 
            +
                alias_method :end_with?, :end_with
         | 
| 95 97 |  | 
| 96 98 | 
             
                # Check if elements in self start with a literal pattern.
         | 
| 97 99 | 
             
                #
         | 
| @@ -104,22 +106,23 @@ module RedAmber | |
| 104 106 | 
             
                #   nil inputs emit nil.
         | 
| 105 107 | 
             
                # @example Check if start with?.
         | 
| 106 108 | 
             
                #   vector = Vector.new('array', 'Arrow', 'carrot', nil, 'window')
         | 
| 107 | 
            -
                #   vector.start_with | 
| 109 | 
            +
                #   vector.start_with('arr')
         | 
| 108 110 | 
             
                #   # =>
         | 
| 109 111 | 
             
                #   #<RedAmber::Vector(:boolean, size=5):0x00000000000193fc>
         | 
| 110 | 
            -
                #   [ | 
| 112 | 
            +
                #   [true, false, false, nil, false]
         | 
| 111 113 | 
             
                # @since 0.5.0
         | 
| 112 114 | 
             
                #
         | 
| 113 | 
            -
                def start_with | 
| 115 | 
            +
                def start_with(string, ignore_case: nil)
         | 
| 114 116 | 
             
                  options = Arrow::MatchSubstringOptions.new
         | 
| 115 117 | 
             
                  options.ignore_case = (ignore_case || false)
         | 
| 116 118 | 
             
                  options.pattern = string
         | 
| 117 119 | 
             
                  datum = find(:starts_with).execute([data], options)
         | 
| 118 120 | 
             
                  Vector.create(datum.value)
         | 
| 119 121 | 
             
                end
         | 
| 122 | 
            +
                alias_method :start_with?, :start_with
         | 
| 120 123 |  | 
| 121 124 | 
             
                # Match elements of self against SQL-style LIKE pattern.
         | 
| 122 | 
            -
                #    | 
| 125 | 
            +
                #   The pattern matches a given pattern at any position.
         | 
| 123 126 | 
             
                #   '%' will match any number of characters,
         | 
| 124 127 | 
             
                #   '_' will match exactly one character,
         | 
| 125 128 | 
             
                #   and any other character matches itself.
         | 
| @@ -134,17 +137,18 @@ module RedAmber | |
| 134 137 | 
             
                #   nil inputs emit nil.
         | 
| 135 138 | 
             
                # @example Check with match_like?.
         | 
| 136 139 | 
             
                #   vector = Vector.new('array', 'Arrow', 'carrot', nil, 'window')
         | 
| 137 | 
            -
                #   vector.match_like | 
| 140 | 
            +
                #   vector.match_like('_rr%')
         | 
| 138 141 | 
             
                #   # =>
         | 
| 139 142 | 
             
                # @since 0.5.0
         | 
| 140 143 | 
             
                #
         | 
| 141 | 
            -
                def match_like | 
| 144 | 
            +
                def match_like(string, ignore_case: nil)
         | 
| 142 145 | 
             
                  options = Arrow::MatchSubstringOptions.new
         | 
| 143 146 | 
             
                  options.ignore_case = (ignore_case || false)
         | 
| 144 147 | 
             
                  options.pattern = string
         | 
| 145 148 | 
             
                  datum = find(:match_like).execute([data], options)
         | 
| 146 149 | 
             
                  Vector.create(datum.value)
         | 
| 147 150 | 
             
                end
         | 
| 151 | 
            +
                alias_method :match_like?, :match_like
         | 
| 148 152 |  | 
| 149 153 | 
             
                # For each string in self, count occuerences of substring in given pattern.
         | 
| 150 154 | 
             
                #
         | 
| @@ -207,5 +211,69 @@ module RedAmber | |
| 207 211 | 
             
                    end
         | 
| 208 212 | 
             
                  Vector.create(datum.value)
         | 
| 209 213 | 
             
                end
         | 
| 214 | 
            +
             | 
| 215 | 
            +
                # Find first occurrence of substring in string Vector.
         | 
| 216 | 
            +
                #
         | 
| 217 | 
            +
                # @overload find_substring(string, ignore_case: nil)
         | 
| 218 | 
            +
                #   Emit the index in bytes of the first occurrence of the given
         | 
| 219 | 
            +
                #     literal pattern, or -1 if not found.
         | 
| 220 | 
            +
                #
         | 
| 221 | 
            +
                #   @param string [String]
         | 
| 222 | 
            +
                #     string pattern to match.
         | 
| 223 | 
            +
                #   @param ignore_case [boolean]
         | 
| 224 | 
            +
                #     switch whether to ignore case. Ignore case if true.
         | 
| 225 | 
            +
                #   @return [Vector]
         | 
| 226 | 
            +
                #     index Vector of occurences.
         | 
| 227 | 
            +
                #     nil inputs emit nil.
         | 
| 228 | 
            +
                #   @example Match with string.
         | 
| 229 | 
            +
                #     vector = Vector['array', 'Arrow', 'carrot', nil, 'window']
         | 
| 230 | 
            +
                #     vector.find_substring('arr')
         | 
| 231 | 
            +
                #     # =>
         | 
| 232 | 
            +
                #     #<RedAmber::Vector(:boolean, size=5):0x00000000000161e8>
         | 
| 233 | 
            +
                #     [0, -1, 1, nil, -1]
         | 
| 234 | 
            +
                #
         | 
| 235 | 
            +
                # @overload find_substring(regexp, ignore_case: nil)
         | 
| 236 | 
            +
                #   Emit the index in bytes of the first occurrence of the given
         | 
| 237 | 
            +
                #     regexp pattern, or -1 if not found.
         | 
| 238 | 
            +
                #   It calls `find_substring_regex` in Arrow compute function and
         | 
| 239 | 
            +
                #   uses re2 library.
         | 
| 240 | 
            +
                #
         | 
| 241 | 
            +
                #   @param regexp [Regexp]
         | 
| 242 | 
            +
                #     regular expression pattern to match. Ruby's Regexp is given and
         | 
| 243 | 
            +
                #     it will passed to Arrow's kernel by its source.
         | 
| 244 | 
            +
                #   @param ignore_case [boolean]
         | 
| 245 | 
            +
                #     switch whether to ignore case. Ignore case if true.
         | 
| 246 | 
            +
                #     When `ignore_case` is false, casefolding option in regexp is priortized.
         | 
| 247 | 
            +
                #   @return [Vector]
         | 
| 248 | 
            +
                #     index Vector of occurences.
         | 
| 249 | 
            +
                #     nil inputs emit nil.
         | 
| 250 | 
            +
                #   @example Match with regexp.
         | 
| 251 | 
            +
                #     vector.find_substring(/arr/i)
         | 
| 252 | 
            +
                #     # or vector.find_substring(/arr/, ignore_case: true)
         | 
| 253 | 
            +
                #     # =>
         | 
| 254 | 
            +
                #     #<RedAmber::Vector(:boolean, size=5):0x000000000001b74c>
         | 
| 255 | 
            +
                #     [0, 0, 1, nil, -1]
         | 
| 256 | 
            +
                #
         | 
| 257 | 
            +
                # @since 0.5.1
         | 
| 258 | 
            +
                #
         | 
| 259 | 
            +
                def find_substring(pattern, ignore_case: nil)
         | 
| 260 | 
            +
                  options = Arrow::MatchSubstringOptions.new
         | 
| 261 | 
            +
                  datum =
         | 
| 262 | 
            +
                    case pattern
         | 
| 263 | 
            +
                    when String
         | 
| 264 | 
            +
                      options.ignore_case = (ignore_case || false)
         | 
| 265 | 
            +
                      options.pattern = pattern
         | 
| 266 | 
            +
                      find(:find_substring).execute([data], options)
         | 
| 267 | 
            +
                    when Regexp
         | 
| 268 | 
            +
                      options.ignore_case = (pattern.casefold? || ignore_case || false)
         | 
| 269 | 
            +
                      options.pattern = pattern.source
         | 
| 270 | 
            +
                      find(:find_substring_regex).execute([data], options)
         | 
| 271 | 
            +
                    else
         | 
| 272 | 
            +
                      message =
         | 
| 273 | 
            +
                        "pattern must be either String or Regexp: #{pattern.inspect}"
         | 
| 274 | 
            +
                      raise VectorArgumentError, message
         | 
| 275 | 
            +
                    end
         | 
| 276 | 
            +
                  Vector.create(datum.value)
         | 
| 277 | 
            +
                end
         | 
| 210 278 | 
             
              end
         | 
| 211 279 | 
             
            end
         | 
    
        data/lib/red_amber/version.rb
    CHANGED
    
    
    
        data/red_amber.gemspec
    CHANGED
    
    | @@ -8,8 +8,8 @@ Gem::Specification.new do |spec| | |
| 8 8 | 
             
              spec.authors = ['Hirokazu SUZUKI (heronshoes)']
         | 
| 9 9 | 
             
              spec.email = ['heronshoes877@gmail.com']
         | 
| 10 10 |  | 
| 11 | 
            -
              spec.summary = ' | 
| 12 | 
            -
              spec.description = 'RedAmber is a  | 
| 11 | 
            +
              spec.summary = 'A data frame library for Rubyists'
         | 
| 12 | 
            +
              spec.description = 'RedAmber is a data frame library ' \
         | 
| 13 13 | 
             
                                 'inspired by Rover-df and powered by Red Arrow.'
         | 
| 14 14 | 
             
              spec.homepage = 'https://github.com/red-data-tools/red_amber'
         | 
| 15 15 | 
             
              spec.license = 'MIT'
         | 
| @@ -31,7 +31,7 @@ Gem::Specification.new do |spec| | |
| 31 31 | 
             
              spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
         | 
| 32 32 | 
             
              spec.require_paths = ['lib']
         | 
| 33 33 |  | 
| 34 | 
            -
              spec.add_dependency 'red-arrow', ' | 
| 34 | 
            +
              spec.add_dependency 'red-arrow', '>= 12.0.0'
         | 
| 35 35 |  | 
| 36 36 | 
             
              # Development dependency has gone to the Gemfile (rubygems/bundler#7237)
         | 
| 37 37 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,37 +1,40 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: red_amber
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.5. | 
| 4 | 
            +
              version: 0.5.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Hirokazu SUZUKI (heronshoes)
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2023- | 
| 11 | 
            +
            date: 2023-08-31 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: red-arrow
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - - " | 
| 17 | 
            +
                - - ">="
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 19 | 
             
                    version: 12.0.0
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 | 
            -
                - - " | 
| 24 | 
            +
                - - ">="
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 26 | 
             
                    version: 12.0.0
         | 
| 27 | 
            -
            description: RedAmber is a  | 
| 28 | 
            -
               | 
| 27 | 
            +
            description: RedAmber is a data frame library inspired by Rover-df and powered by
         | 
| 28 | 
            +
              Red Arrow.
         | 
| 29 29 | 
             
            email:
         | 
| 30 30 | 
             
            - heronshoes877@gmail.com
         | 
| 31 31 | 
             
            executables: []
         | 
| 32 32 | 
             
            extensions: []
         | 
| 33 33 | 
             
            extra_rdoc_files: []
         | 
| 34 34 | 
             
            files:
         | 
| 35 | 
            +
            - ".devcontainer/Dockerfile"
         | 
| 36 | 
            +
            - ".devcontainer/devcontainer.json"
         | 
| 37 | 
            +
            - ".devcontainer/onCreateCommand.sh"
         | 
| 35 38 | 
             
            - ".rubocop.yml"
         | 
| 36 39 | 
             
            - ".rubocop_todo.yml"
         | 
| 37 40 | 
             
            - ".yardopts"
         | 
| @@ -56,6 +59,9 @@ files: | |
| 56 59 | 
             
            - doc/CODE_OF_CONDUCT.md
         | 
| 57 60 | 
             
            - doc/DataFrame.md
         | 
| 58 61 | 
             
            - doc/DataFrame_Comparison.md
         | 
| 62 | 
            +
            - doc/DataFrame_Comparison_ja.md
         | 
| 63 | 
            +
            - doc/Dev_Containers.ja.md
         | 
| 64 | 
            +
            - doc/Dev_Containers.md
         | 
| 59 65 | 
             
            - doc/SubFrames.md
         | 
| 60 66 | 
             
            - doc/Vector.md
         | 
| 61 67 | 
             
            - doc/image/arrow_table_new.png
         | 
| @@ -85,17 +91,15 @@ files: | |
| 85 91 | 
             
            - doc/image/vector/unary_aggregation.png
         | 
| 86 92 | 
             
            - doc/image/vector/unary_aggregation_w_option.png
         | 
| 87 93 | 
             
            - doc/image/vector/unary_element_wise.png
         | 
| 94 | 
            +
            - doc/qmd/examples_of_red_amber.qmd
         | 
| 95 | 
            +
            - doc/qmd/red-amber.qmd
         | 
| 88 96 | 
             
            - doc/tdr.md
         | 
| 89 97 | 
             
            - doc/tdr_ja.md
         | 
| 90 98 | 
             
            - doc/yard-templates/default/fulldoc/html/css/common.css
         | 
| 91 99 | 
             
            - docker/.env
         | 
| 92 100 | 
             
            - docker/Dockerfile
         | 
| 93 101 | 
             
            - docker/Gemfile
         | 
| 94 | 
            -
            - docker/Gemfile.lock
         | 
| 95 102 | 
             
            - docker/docker-compose.yml
         | 
| 96 | 
            -
            - docker/example
         | 
| 97 | 
            -
            - docker/notebook/examples_of_red_amber.ipynb
         | 
| 98 | 
            -
            - docker/notebook/red-amber.ipynb
         | 
| 99 103 | 
             
            - docker/readme.md
         | 
| 100 104 | 
             
            - lib/red-amber.rb
         | 
| 101 105 | 
             
            - lib/red_amber.rb
         | 
| @@ -147,5 +151,5 @@ requirements: [] | |
| 147 151 | 
             
            rubygems_version: 3.4.12
         | 
| 148 152 | 
             
            signing_key:
         | 
| 149 153 | 
             
            specification_version: 4
         | 
| 150 | 
            -
            summary:  | 
| 154 | 
            +
            summary: A data frame library for Rubyists
         | 
| 151 155 | 
             
            test_files: []
         | 
    
        data/docker/Gemfile.lock
    DELETED
    
    | @@ -1,118 +0,0 @@ | |
| 1 | 
            -
            PATH
         | 
| 2 | 
            -
              remote: ..
         | 
| 3 | 
            -
              specs:
         | 
| 4 | 
            -
                red_amber (0.5.0.pre.HEAD)
         | 
| 5 | 
            -
                  red-arrow (~> 12.0.0)
         | 
| 6 | 
            -
             | 
| 7 | 
            -
            GEM
         | 
| 8 | 
            -
              remote: https://rubygems.org/
         | 
| 9 | 
            -
              specs:
         | 
| 10 | 
            -
                benchmark-ips (2.12.0)
         | 
| 11 | 
            -
                benchmark_driver (0.16.3)
         | 
| 12 | 
            -
                bigdecimal (3.1.4)
         | 
| 13 | 
            -
                charty (0.2.12)
         | 
| 14 | 
            -
                  matplotlib (>= 1.2.0)
         | 
| 15 | 
            -
                  pandas (>= 0.3.5)
         | 
| 16 | 
            -
                  playwright-ruby-client
         | 
| 17 | 
            -
                  red-colors (>= 0.3.0)
         | 
| 18 | 
            -
                  red-datasets (>= 0.1.2)
         | 
| 19 | 
            -
                  red-palette (>= 0.5.0)
         | 
| 20 | 
            -
                concurrent-ruby (1.2.2)
         | 
| 21 | 
            -
                csv (3.2.6)
         | 
| 22 | 
            -
                enumerable-statistics (2.0.7)
         | 
| 23 | 
            -
                extpp (0.1.1)
         | 
| 24 | 
            -
                faker (3.1.1)
         | 
| 25 | 
            -
                  i18n (>= 1.8.11, < 2)
         | 
| 26 | 
            -
                fiddle (1.1.1)
         | 
| 27 | 
            -
                gio2 (4.1.4)
         | 
| 28 | 
            -
                  fiddle
         | 
| 29 | 
            -
                  gobject-introspection (= 4.1.4)
         | 
| 30 | 
            -
                glib2 (4.1.4)
         | 
| 31 | 
            -
                  native-package-installer (>= 1.0.3)
         | 
| 32 | 
            -
                  pkg-config (>= 1.3.5)
         | 
| 33 | 
            -
                gobject-introspection (4.1.4)
         | 
| 34 | 
            -
                  glib2 (= 4.1.4)
         | 
| 35 | 
            -
                i18n (1.12.0)
         | 
| 36 | 
            -
                  concurrent-ruby (~> 1.0)
         | 
| 37 | 
            -
                io-console (0.6.0)
         | 
| 38 | 
            -
                irb (1.6.4)
         | 
| 39 | 
            -
                  reline (>= 0.3.0)
         | 
| 40 | 
            -
                libui (0.0.15)
         | 
| 41 | 
            -
                matplotlib (1.3.0)
         | 
| 42 | 
            -
                  pycall (>= 1.0.0)
         | 
| 43 | 
            -
                matrix (0.4.2)
         | 
| 44 | 
            -
                mime-types (3.4.1)
         | 
| 45 | 
            -
                  mime-types-data (~> 3.2015)
         | 
| 46 | 
            -
                mime-types-data (3.2023.0218.1)
         | 
| 47 | 
            -
                native-package-installer (1.1.5)
         | 
| 48 | 
            -
                numo-narray (0.9.2.1)
         | 
| 49 | 
            -
                numpy (0.4.0)
         | 
| 50 | 
            -
                  pycall (>= 1.2.0.beta1)
         | 
| 51 | 
            -
                pandas (0.3.8)
         | 
| 52 | 
            -
                  numpy
         | 
| 53 | 
            -
                  pycall (>= 1.0.0)
         | 
| 54 | 
            -
                pkg-config (1.5.1)
         | 
| 55 | 
            -
                playwright-ruby-client (1.31.1)
         | 
| 56 | 
            -
                  concurrent-ruby (>= 1.1.6)
         | 
| 57 | 
            -
                  mime-types (>= 3.0)
         | 
| 58 | 
            -
                pycall (1.4.2)
         | 
| 59 | 
            -
                red-amber-view (0.0.1)
         | 
| 60 | 
            -
                  libui
         | 
| 61 | 
            -
                  red-arrow
         | 
| 62 | 
            -
                  red_amber
         | 
| 63 | 
            -
                red-arrow (12.0.0)
         | 
| 64 | 
            -
                  bigdecimal (>= 3.1.0)
         | 
| 65 | 
            -
                  extpp (>= 0.1.1)
         | 
| 66 | 
            -
                  gio2 (>= 3.5.0)
         | 
| 67 | 
            -
                  native-package-installer
         | 
| 68 | 
            -
                  pkg-config
         | 
| 69 | 
            -
                red-arrow-numo-narray (0.0.6)
         | 
| 70 | 
            -
                  numo-narray
         | 
| 71 | 
            -
                  red-arrow
         | 
| 72 | 
            -
                red-colors (0.3.0)
         | 
| 73 | 
            -
                  matrix
         | 
| 74 | 
            -
                red-datasets (0.1.5)
         | 
| 75 | 
            -
                  csv (>= 3.2.4)
         | 
| 76 | 
            -
                  rexml
         | 
| 77 | 
            -
                  rubyzip
         | 
| 78 | 
            -
                red-datasets-arrow (0.0.3)
         | 
| 79 | 
            -
                  red-arrow
         | 
| 80 | 
            -
                  red-datasets (>= 0.0.3)
         | 
| 81 | 
            -
                red-palette (0.5.0)
         | 
| 82 | 
            -
                  red-colors (>= 0.3.0)
         | 
| 83 | 
            -
                red-parquet (12.0.0)
         | 
| 84 | 
            -
                  red-arrow (= 12.0.0)
         | 
| 85 | 
            -
                reline (0.3.3)
         | 
| 86 | 
            -
                  io-console (~> 0.5)
         | 
| 87 | 
            -
                rexml (3.2.5)
         | 
| 88 | 
            -
                rover-df (0.3.4)
         | 
| 89 | 
            -
                  numo-narray (>= 0.9.1.9)
         | 
| 90 | 
            -
                rubyzip (2.3.2)
         | 
| 91 | 
            -
                unicode_plot (0.0.5)
         | 
| 92 | 
            -
                  enumerable-statistics (>= 2.0.1)
         | 
| 93 | 
            -
             | 
| 94 | 
            -
            PLATFORMS
         | 
| 95 | 
            -
              x86_64-darwin-20
         | 
| 96 | 
            -
              x86_64-linux
         | 
| 97 | 
            -
             | 
| 98 | 
            -
            DEPENDENCIES
         | 
| 99 | 
            -
              benchmark-ips
         | 
| 100 | 
            -
              benchmark_driver
         | 
| 101 | 
            -
              charty
         | 
| 102 | 
            -
              faker
         | 
| 103 | 
            -
              irb
         | 
| 104 | 
            -
              matplotlib
         | 
| 105 | 
            -
              numo-narray
         | 
| 106 | 
            -
              pycall
         | 
| 107 | 
            -
              red-amber-view
         | 
| 108 | 
            -
              red-arrow (~> 12.0.0)
         | 
| 109 | 
            -
              red-arrow-numo-narray
         | 
| 110 | 
            -
              red-datasets
         | 
| 111 | 
            -
              red-datasets-arrow
         | 
| 112 | 
            -
              red-parquet (~> 12.0.0)
         | 
| 113 | 
            -
              red_amber!
         | 
| 114 | 
            -
              rover-df
         | 
| 115 | 
            -
              unicode_plot
         | 
| 116 | 
            -
             | 
| 117 | 
            -
            BUNDLED WITH
         | 
| 118 | 
            -
               2.4.12
         | 
    
        data/docker/example
    DELETED
    
    | @@ -1,86 +0,0 @@ | |
| 1 | 
            -
            #!/usr/bin/env ruby
         | 
| 2 | 
            -
            # frozen_string_literal: true
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            print "starting.\r"
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            Dir.chdir(__dir__) { require 'bundler/setup' }
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            print "starting..\r"
         | 
| 9 | 
            -
            require 'red_amber'
         | 
| 10 | 
            -
            include RedAmber
         | 
| 11 | 
            -
             | 
| 12 | 
            -
            print "starting...\r"
         | 
| 13 | 
            -
            require 'datasets-arrow'
         | 
| 14 | 
            -
             | 
| 15 | 
            -
            print "reading penguins...\r"
         | 
| 16 | 
            -
            penguins = DataFrame.new(Datasets::Penguins.new)
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            print "reading diamonds...\r"
         | 
| 19 | 
            -
            diamonds = DataFrame.new(Datasets::Diamonds.new)
         | 
| 20 | 
            -
             | 
| 21 | 
            -
            print "reading starwars...\r"
         | 
| 22 | 
            -
            starwars = DataFrame.new(Datasets::Rdataset.new('dplyr', 'starwars'))
         | 
| 23 | 
            -
             | 
| 24 | 
            -
            print "reading openintro/simpsons_paradox_covid...\r"
         | 
| 25 | 
            -
            ds = Datasets::Rdataset.new('openintro', 'simpsons_paradox_covid')
         | 
| 26 | 
            -
            simpsons_paradox_covid = DataFrame.new(ds.to_arrow)
         | 
| 27 | 
            -
             | 
| 28 | 
            -
            print "reading mtcars...                          \r"
         | 
| 29 | 
            -
            mtcars = DataFrame.new(Datasets::Rdatasets.new('datasets', 'mtcars'))
         | 
| 30 | 
            -
             | 
| 31 | 
            -
            print "reading iris...  \r"
         | 
| 32 | 
            -
            iris = DataFrame.new(Datasets::Iris.new)
         | 
| 33 | 
            -
             | 
| 34 | 
            -
            print "reading band_members...\r"
         | 
| 35 | 
            -
            band_members = DataFrame.new(Datasets::Rdatasets.new('dplyr', 'band_members'))
         | 
| 36 | 
            -
             | 
| 37 | 
            -
            print "reading band_instruments...\r"
         | 
| 38 | 
            -
            band_instruments = DataFrame.new(Datasets::Rdatasets.new('dplyr', 'band_instruments'))
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            print "reading band_instruments2...\r"
         | 
| 41 | 
            -
            band_instruments2 = DataFrame.new(Datasets::Rdatasets.new('dplyr', 'band_instruments2'))
         | 
| 42 | 
            -
             | 
| 43 | 
            -
            print "reading import_cars...      \r"
         | 
| 44 | 
            -
            import_cars = DataFrame.load(Arrow::Buffer.new(<<~TSV), format: :tsv)
         | 
| 45 | 
            -
              Year	Audi	BMW	BMW_MINI	Mercedes-Benz	VW
         | 
| 46 | 
            -
              2017	28336	52527	25427	68221	49040
         | 
| 47 | 
            -
              2018	26473	50982	25984	67554	51961
         | 
| 48 | 
            -
              2019	24222	46814	23813	66553	46794
         | 
| 49 | 
            -
              2020	22304	35712	20196	57041	36576
         | 
| 50 | 
            -
              2021	22535	35905	18211	51722	35215
         | 
| 51 | 
            -
            TSV
         | 
| 52 | 
            -
             | 
| 53 | 
            -
            print "reading comecome...   \r"
         | 
| 54 | 
            -
            comecome = DataFrame.load(Arrow::Buffer.new(<<~CSV), format: :csv)
         | 
| 55 | 
            -
              name,age
         | 
| 56 | 
            -
              Yasuko,68
         | 
| 57 | 
            -
              Rui,49
         | 
| 58 | 
            -
              Hinata,28
         | 
| 59 | 
            -
            CSV
         | 
| 60 | 
            -
             | 
| 61 | 
            -
            print "reading rubykaigi...   \r"
         | 
| 62 | 
            -
            rubykaigi = DataFrame.load(Arrow::Buffer.new(<<~CSV), format: :csv)
         | 
| 63 | 
            -
              year,venue,prefecture,city,venue_en
         | 
| 64 | 
            -
              2015,ベルサール汐留,東京都,中央区,"Bellesalle Shiodome"
         | 
| 65 | 
            -
              2016,京都国際会議場,京都府,京都市左京区,"Kyoto International Conference Center"
         | 
| 66 | 
            -
              2017,広島国際会議場,広島県,広島市中区,"International Conference Center Hiroshima"
         | 
| 67 | 
            -
              2018,仙台国際センター,宮城県,仙台市青葉区,"Sendai International Center"
         | 
| 68 | 
            -
              2019,福岡国際会議場,福岡県,福岡市博多区,"Fukuoka International Congress Center"
         | 
| 69 | 
            -
              2022,三重県総合文化センター,三重県,津市,"Mie Center for the Arts"
         | 
| 70 | 
            -
              2023,松本市民芸術館,長野県,松本市,"Matsumoto Performing Arts Centre"
         | 
| 71 | 
            -
            CSV
         | 
| 72 | 
            -
             | 
| 73 | 
            -
            print "reading general dataframe and subframes...\r"
         | 
| 74 | 
            -
            dataframe = DataFrame.new(
         | 
| 75 | 
            -
              x: [*1..6],
         | 
| 76 | 
            -
              y: %w[A A B B B C],
         | 
| 77 | 
            -
              z: [false, true, false, nil, true, false]
         | 
| 78 | 
            -
            )
         | 
| 79 | 
            -
            subframes = SubFrames.new(dataframe, [[0, 1], [2, 3, 4], [5]])
         | 
| 80 | 
            -
             | 
| 81 | 
            -
            # Welcome to RedAmber example!
         | 
| 82 | 
            -
            # This environment will offer these pre-loaded datasets:
         | 
| 83 | 
            -
            #   penguins, diamonds, iris, starwars, simpsons_paradox_covid,
         | 
| 84 | 
            -
            #   mtcars, band_members, band_instruments, band_instruments2
         | 
| 85 | 
            -
            #   import_cars, comecome, rubykaigi, dataframe, subframes
         | 
| 86 | 
            -
            binding.irb
         |