namo.rb 0.32.6 → 0.32.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 954dd56c44720e92c0069bd80cc9c4b3be9a34f186890d23b68705d9ef27d923
4
- data.tar.gz: 575c56ff4c119e501450ec6abf17eaf0c15e3883ef57c71017fc8da1352d6a7d
3
+ metadata.gz: 4889db6dce5c63a9cc355e5b68611a33cb1dacbe94f678a6b11cd0a5c5c3fb0c
4
+ data.tar.gz: 561246d0002efb96b1235fbf7d64b20e4816217a78757477a2784a016e5a94c2
5
5
  SHA512:
6
- metadata.gz: '05958561658c95747135d6dcb214de212dab6e0822f29475a6cff5ce62772789535e5b4a73b81f967c137f6a62e8938b5f66170f0ab32a4db39118617c25a74e'
7
- data.tar.gz: aa10b17f58cb4658caeb6e9e763106a3d3fd797e8190bcc8b45d7efc764d60a3554b72b5ba5850b08bad0b1596aabf9e8eee383fda57e892540504512ad11a69
6
+ metadata.gz: 130de24b9419ccb107195ae5205dda09c5f46fd996dba9f38ea976a19619e9718cbb1d812810cf737571b955f1438e4651bfd6a39d5d5c8cf4a709b62cfb4596
7
+ data.tar.gz: c4c90a3798c7caf69e19c069979f423648c64fa8d53dd9122da8187d5d7e2db3f70d2e463d5b922ea61fe6d4fe53fc16cdc0cf1d98138a905f7603baf08a294f
data/CHANGELOG CHANGED
@@ -1,7 +1,42 @@
1
- # CHANGELOG
1
+ # namo/CHANGELOG
2
+
3
+ ## 20261102
4
+
5
+ 0.32.8: ~ Namo::Row#match?: A Range selects by cover?, so beginless and endless ranges of Dates and Strings select rather than raising TypeError.
6
+
7
+ 1. ~ Namo::Row#match?: A Range is tested with cover? and an Array with include?, where both had been tested with include?, which raises for a beginless or endless range of anything not numeric. A bounded range of Strings now selects by ordering, as a bounded range of numbers already did, rather than by membership of its succ sequence.
8
+ 2. + test/namo_test.rb: beginless and endless ranges of Dates and of Strings select; a two-arity formula windows over Dates.
9
+ 3. ~ COMPARISON.md: - the note that the windowed formulae want numeric dates.
10
+ 4. ~ comparison/namo_claims.rb: - the comment saying a beginless range of Dates raises.
11
+ 5. ~ ROADMAP.md: + 0.32.8.
12
+ 6. ~ Namo::VERSION: /0.32.7/0.32.8/
13
+
14
+ 0.32.7: ~ COMPARISON.md: Verify and where necessary correct claims made about pandas, Polars, xarray, dplyr, and DataFrames.jl; + comparison/*_claims, which contain executable verification code.
15
+
16
+ 1. + comparison/namo_claims.rb, pandas_claims.py, polars_claims.py, xarray_claims.py, dplyr_claims.R, dataframes_claims.jl: each runs every snippet COMPARISON.md shows for its tool, on inline data, then the probes behind its claims.
17
+ 2. ~ COMPARISON.md: + the versions compared and a pointer to the scripts; the date is the day of checking.
18
+ 3. ~ COMPARISON.md: Polars: `filter` takes keyword equality; one `with_columns` doesn't see the columns it makes; `melt` is `unpivot` and `frame_equal` is gone; `join_where`, `pl.Schema` and `assert_frame_equal(check_row_order=False)` added where they answer a "none offers" claim.
19
+ 4. ~ COMPARISON.md: pandas: a join with no `on=` doesn't warn; `.loc` takes rows and columns in one call, and a callable; strings infer as `str`, not `object`; registered accessors noted against parameterised formulae and formularies.
20
+ 5. ~ COMPARISON.md: xarray: `.str` on coordinates and string data variables; `sel` with a scalar, a list and a slice in one call, and none over repeated labels; `sel(method='ffill')` as an asof lookup; `where` with `drop=True` and a callable; `identical`/`equals`/`broadcast_equals`.
21
+ 6. ~ COMPARISON.md: dplyr: `symdiff()`, `setequal()`, `cross_join()` and `join_by()`'s rolling and inequality joins exist; a join with no `by` messages rather than warns; `all_equal()` gave way to `all.equal()`; a tibble keeps no row names; `filter()` wants vectorised predicates; zoo's `rollmean` centres its window, so the snippets take `align = 'right'`.
22
+ 7. ~ COMPARISON.md: DataFrames.jl: `==` returns one Bool; `symdiff` works on Sets of rows; `Tables.columntable` is the columnar conversion; the rolling snippets pad `rollmean` under `transform`, `combine` having refused windows of two lengths.
23
+ 8. ~ COMPARISON.md: the summaries those contradicted narrowed, and unsourced claims dropped; + at 0.32.7 a beginless range of Dates or Strings raises `TypeError` in selection, so the windowed formulae want numeric dates.
24
+ 9. ~ comparison/README.md: + the claims scripts.
25
+ 10. ~ .gitignore: + comparison/.venv/, comparison/.tools/.
26
+ 11. ~ namo.rb.gemspec: the gemspec heads the file list, as in namo.gemspec.
27
+ 12. ~ CHANGELOG: the heading names the project, `# namo/CHANGELOG`; + the 0.32.6 entry, which 0.32.6 shipped without.
28
+ 13. ~ Namo::VERSION: /0.32.6/0.32.7/
2
29
 
3
30
  ## 20261003
4
31
 
32
+ 0.32.6: ~ Namo::Enumerable#group_by: the block form and the no-argument call raise errors which say what to do instead.
33
+
34
+ 1. ~ Namo::Enumerable#group_by: When called with a block, it raises an ArgumentError naming the block form as unimplemented and entries.group_by{|row| ...} as the way to partition by a computed key, where Ruby's arity error said only that the count was wrong — which told the reader something was broken rather than that the boundary was drawn at 0.20.0, a computed key having no dimension to round-trip through.
35
+ 2. ~ Namo::Enumerable#group_by: When called with no argument, it raises 'group_by needs a dimension' rather than the same arity error.
36
+ 3. ~ README.md: The group_by section says it takes a dimension and no block, and what entries.group_by returns instead.
37
+ 4. ~ ROADMAP.md: + 0.32.6; + the optimisation candidates already in view, parked under 1.1 until there is a baseline to measure them against.
38
+ 5. ~ Namo::VERSION: /0.32.5/0.32.6/
39
+
5
40
  0.32.5: Documentation clean up.
6
41
 
7
42
  1. ~ README.md: + what Symbol#-@ costs, and why `/` dedupes.
data/lib/Namo/Row.rb CHANGED
@@ -27,8 +27,10 @@ class Namo
27
27
  def match?(selections)
28
28
  selections.all? do |dimension, coordinate|
29
29
  case coordinate
30
- when Array, Range
30
+ when Array
31
31
  coordinate.include?(self[dimension])
32
+ when Range
33
+ coordinate.cover?(self[dimension])
32
34
  when Proc
33
35
  coordinate.call(self[dimension])
34
36
  when Regexp
data/lib/Namo/VERSION.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Namo::VERSION
3
3
 
4
4
  class Namo
5
- VERSION = '0.32.6'
5
+ VERSION = '0.32.8'
6
6
  end
data/namo.rb.gemspec CHANGED
@@ -27,13 +27,13 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ['lib']
28
28
 
29
29
  spec.files = [
30
+ 'namo.rb.gemspec',
30
31
  Dir['bin/*'],
31
32
  Dir['lib/**/*.rb'],
32
33
  Dir['test/**/*.rb'],
33
34
  'CHANGELOG',
34
35
  'Gemfile',
35
36
  'LICENSE',
36
- 'namo.rb.gemspec',
37
37
  'Rakefile',
38
38
  'README.md',
39
39
  ].flatten
data/test/namo_test.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'minitest/autorun'
2
2
  require 'minitest-spec-context'
3
3
 
4
+ require 'date'
5
+
4
6
  require_relative '../lib/namo'
5
7
 
6
8
  module SupportedFlow
@@ -559,6 +561,36 @@ describe Namo do
559
561
  _(sales[quantity: 100..].to_a.count).must_equal 2
560
562
  end
561
563
 
564
+ it "supports beginless and endless ranges of Dates" do
565
+ dated = Namo.new([
566
+ {date: Date.new(2026, 1, 1), close: 1},
567
+ {date: Date.new(2026, 1, 2), close: 2},
568
+ {date: Date.new(2026, 1, 3), close: 3},
569
+ ])
570
+ _(dated[date: ..Date.new(2026, 1, 2)].values(:close)).must_equal [1, 2]
571
+ _(dated[date: Date.new(2026, 1, 2)..].values(:close)).must_equal [2, 3]
572
+ end
573
+
574
+ it "supports beginless and endless ranges of Strings" do
575
+ dated = Namo.new([
576
+ {date: "2026-01-01", close: 1},
577
+ {date: "2026-01-02", close: 2},
578
+ {date: "2026-01-03", close: 3},
579
+ ])
580
+ _(dated[date: .."2026-01-02"].values(:close)).must_equal [1, 2]
581
+ _(dated[date: "2026-01-02"..].values(:close)).must_equal [2, 3]
582
+ end
583
+
584
+ it "windows a two-arity formula over Dates" do
585
+ dated = Namo.new([
586
+ {date: Date.new(2026, 1, 1), close: 1},
587
+ {date: Date.new(2026, 1, 2), close: 2},
588
+ {date: Date.new(2026, 1, 3), close: 3},
589
+ ])
590
+ dated[:running] = proc{|row, namo| namo[date: ..row[:date]].values(:close).sum}
591
+ _(dated.values(:running)).must_equal [1, 3, 6]
592
+ end
593
+
562
594
  it "composes with projection in a single call" do
563
595
  result = sales[:product, :quantity, quantity: 50..120]
564
596
  _(result.to_a).must_equal [
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: namo.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.32.6
4
+ version: 0.32.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
- rubygems_version: 4.0.21
108
+ rubygems_version: 4.0.23
109
109
  specification_version: 4
110
110
  summary: Named dimensional data for Ruby.
111
111
  test_files: []