red_amber 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 264e7637475fd01946900335751a1592a3859e9bfa772ecc0800ab05c4d852f0
4
- data.tar.gz: a57400445419698a66d6b5c94e15fa8c040f2f3930f9fbf75603ffb6e18bd9cf
3
+ metadata.gz: 498f580bc6fc79e36b199cc3ec62c38638e4df903e956a7a78947d9091748d0c
4
+ data.tar.gz: 24c3f25ff47b6bba0af26d1a1c77a80a56c2115e0bd76d26ba3f769f71d3557b
5
5
  SHA512:
6
- metadata.gz: 0fdbcdb732e36bb866a8251800ab3fa1a714fa075234bf8cd516f2542ab6704ebfa429a7177da2bd8cd6fa6eb1158efb0d68f46f43d1dc088a9a0f0debdc5c54
7
- data.tar.gz: f9c1dffaa157ecf34b0b4fec6c1d7972b4773bbf7a11101a345172d621753cd9fc3818753b329dd2906a506af294d6a96c0180a0fb4dc84c2b54bceef6b520f5
6
+ metadata.gz: '085caa83703f4b9be0a3baae3318f0bcb606bbf264347ad3db431b29fb59c87e05b142ab1fd7e8a0af0a3d64b0b81055f1e85d82414f773d01456cf5a386df25'
7
+ data.tar.gz: 901e7eda6560eb2a9ab378d672b39d3ba08ae47012d8465ce541a465d744ce45d93a451ef2bff8fdf838fc1040b12facc58c87d95c6f6bedb89c5c138b95005c
data/.rubocop.yml CHANGED
@@ -52,7 +52,7 @@ Lint/BinaryOperatorWithIdenticalOperands:
52
52
 
53
53
  Lint/Debugger:
54
54
  Exclude:
55
- - 'bin/example'
55
+ - 'docker/example'
56
56
 
57
57
  # Need for test with empty block
58
58
  # Offense count: 1
@@ -219,7 +219,7 @@ Naming/PredicateName:
219
219
  Rubycw/Rubycw:
220
220
  Exclude:
221
221
  - 'test/**/*'
222
- - 'bin/example'
222
+ - 'docker/example'
223
223
 
224
224
  # Offense count: 16
225
225
  # This cop supports safe autocorrection (--autocorrect).
@@ -236,7 +236,7 @@ Style/SlicingWithRange:
236
236
 
237
237
  Style/MixinUsage:
238
238
  Exclude:
239
- - 'bin/example'
239
+ - 'docker/example'
240
240
 
241
241
  # Necessary to Vector < 0 element-wise comparison
242
242
  # Offense count: 5
data/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ ## [0.4.2] - 2023-04-02
2
+
3
+ - Breaking change
4
+
5
+ - Bug fixes
6
+ - Fix Vector#modulo, #fdiv, #remainder (#203)
7
+
8
+ - New features and improvements
9
+ - Update SubFrames#take to return SubFrames (#212)
10
+
11
+ - Refactoring
12
+ - Refine SubFrames to support partial retrieval (#207)
13
+ - Upgrade SubFrames#frames and promote to public (#207)
14
+ - Use faster count in Group#inspect (#207)
15
+
16
+ - Improve in tests/CI
17
+
18
+ - Documentation and Example
19
+ - Introduce minimum docker environment (#205)
20
+ - Move example REPL to docker (#205)
21
+ - Add readme.md in docker (#205)
22
+ - Add example_of_red_amber.ipynb (#205)
23
+ - Use smaller dataset in irb example
24
+ - Fix docker/example
25
+ - Updated link to red-data-tools (#213)
26
+ - Thanks to Soumya Kushwaha
27
+
28
+ - GitHub site
29
+ - Migrated to [Red Data Tools](https://github.com/red-data-tools)
30
+ - Thanks to Sutou Kouhei
31
+
32
+ - Thanks
33
+ - Sutou Kouhei
34
+ - Soumya Kushwaha
35
+
1
36
  ## [0.4.1] - 2023-03-11
2
37
 
3
38
  - Breaking change
@@ -676,7 +711,7 @@
676
711
  - Improve `DataFrame#[]`, `#slice`, `#remove` by a new engine
677
712
  - It parses arguments to Vector internally.
678
713
  - Used Kernel#Array to simplify code (#16) .
679
- - recycle: Move `DataFrame#slice`, `#remove` to Selectable
714
+ - Move `DataFrame#slice`, `#remove` to Selectable
680
715
  - Refine `DataFrame#take`, `#filter` (undocumented)
681
716
 
682
717
  - Introduce coerce in Vector (#35)
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  # RedAmber
2
2
 
3
3
  [![Gem Version](https://img.shields.io/gem/v/red_amber?color=brightgreen)](https://rubygems.org/gems/red_amber)
4
- [![CI](https://github.com/heronshoes/red_amber/actions/workflows/ci.yml/badge.svg)](https://github.com/heronshoes/red_amber/actions/workflows/ci.yml)
4
+ [![CI](https://github.com/heronshoes/red_amber/actions/workflows/ci.yml/badge.svg)](https://github.com/red-data-tools/red_amber/actions/workflows/ci.yml)
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/b8a745047045d2f49daa/maintainability)](https://codeclimate.com/github/heronshoes/red_amber/maintainability)
6
6
  [![Test coverage](https://api.codeclimate.com/v1/badges/b8a745047045d2f49daa/test_coverage)](https://codeclimate.com/github/heronshoes/red_amber/test_coverage)
7
7
  [![Doc](https://img.shields.io/badge/docs-latest-blue)](https://heronshoes.github.io/red_amber/)
8
- [![Discussions](https://img.shields.io/github/discussions/heronshoes/red_amber)](https://github.com/heronshoes/red_amber/discussions)
8
+ [![Discussions](https://img.shields.io/github/discussions/heronshoes/red_amber)](https://github.com/red-data-tools/red_amber/discussions)
9
9
 
10
10
  A simple dataframe library for Ruby.
11
11
 
@@ -13,12 +13,12 @@ A simple dataframe library for Ruby.
13
13
  [![Gitter Chat](https://badges.gitter.im/red-data-tools/en.svg)](https://gitter.im/red-data-tools/en) [![Gem Version](https://img.shields.io/gem/v/red-arrow?color=brightgreen)](https://rubygems.org/gems/red-arrow)
14
14
  - Inspired by the dataframe library [Rover-df](https://github.com/ankane/rover)
15
15
 
16
- ![screenshot from jupyterlab](https://raw.githubusercontent.com/heronshoes/red_amber/main/doc/image/screenshot.png)
16
+ ![screenshot from jupyterlab](https://raw.githubusercontent.com/red-data-tools/red_amber/main/doc/image/screenshot.png)
17
17
 
18
18
  ## Requirements
19
19
  ### Ruby
20
20
  Supported Ruby version is >= 3.0 (since RedAmber 0.3.0).
21
- - I decided to remove support for Ruby 2.7 without waiting for its EOL. See [Release note for v0.3.0](https://github.com/heronshoes/red_amber/discussions/162) for details.
21
+ - I decided to remove support for Ruby 2.7 without waiting for its EOL. See [Release note for v0.3.0](https://github.com/red-data-tools/red_amber/discussions/162) for details.
22
22
 
23
23
  ### Libraries
24
24
  ```ruby
@@ -78,11 +78,13 @@ And then execute `bundle install` or install them yourself such as `gem install
78
78
 
79
79
  ## Docker image and Jupyter Notebook
80
80
 
81
- [RubyData Docker Stacks](https://github.com/RubyData/docker-stacks) is available as a ready-to-run Docker image containing Jupyter and useful data tools as well as RedAmber (Thanks to Kenta Murata).
81
+ Docker image is available from docker folder. See [readme](docker/readme.md) for instruction. Integrated Jypyter notebook is in docker/notebook folder.
82
82
 
83
- Also you can try the contents of this README interactively by [Binder](https://mybinder.org/v2/gh/heronshoes/docker-stacks/RedAmber-binder?filepath=red-amber.ipynb).
83
+ You can try the contents of this README interactively by [Binder](https://mybinder.org/v2/gh/heronshoes/docker-stacks/RedAmber-binder?filepath=red-amber.ipynb).
84
84
  [![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/heronshoes/docker-stacks/RedAmber-binder?filepath=red-amber.ipynb)
85
85
 
86
+ [RubyData Docker Stacks](https://github.com/RubyData/docker-stacks) is available as a ready-to-run Docker image containing Jupyter and useful data tools as well as RedAmber (Thanks to Kenta Murata).
87
+
86
88
  ## Comparison of DataFrames
87
89
 
88
90
  Comparison of basic features of RedAmber with Python
@@ -95,7 +97,7 @@ Julia [Dataframes](https://dataframes.juliadata.org/stable/) is in [DataFrame_Co
95
97
  Class `RedAmber::DataFrame` represents a set of data in 2D-shape.
96
98
  Its entity is a Red Arrow's Table object.
97
99
 
98
- ![dataframe model of RedAmber](https://raw.githubusercontent.com/heronshoes/red_amber/main/doc/image/dataframe_model.png)
100
+ ![dataframe model of RedAmber](https://raw.githubusercontent.com/red-data-tools/red_amber/main/doc/image/dataframe_model.png)
99
101
 
100
102
  Let's load the library and try some examples.
101
103
 
@@ -222,7 +224,7 @@ You can try this notebook on [Binder](https://mybinder.org/v2/gh/heronshoes/dock
222
224
  ## Development
223
225
 
224
226
  ```shell
225
- git clone https://github.com/heronshoes/red_amber.git
227
+ git clone https://github.com/red-data-tools/red_amber.git
226
228
  cd red_amber
227
229
  bundle install
228
230
  bundle exec rake test
@@ -232,12 +234,12 @@ bundle exec rake test
232
234
 
233
235
  I will appreciate if you could help to improve this project. Here are a few ways you can help:
234
236
 
235
- - Let's talk in the [discussions](https://github.com/heronshoes/red_amber/discussions). [![Discussions](https://img.shields.io/github/discussions/heronshoes/red_amber)](https://github.com/heronshoes/red_amber/discussions)
237
+ - Let's talk in the [discussions](https://github.com/heronshoes/red_amber/discussions). [![Discussions](https://img.shields.io/github/discussions/heronshoes/red_amber)](https://github.com/red-data-tools/red_amber/discussions)
236
238
  - Browse Q and A, how to use, tips, etc.
237
239
  - Ask questions you’re wondering about.
238
240
  - Share ideas. The idea may be promoted to issues or pull requests.
239
- - [Report bugs or suggest new features](https://github.com/heronshoes/red_amber/issues)
240
- - Fix bugs and [submit pull requests](https://github.com/heronshoes/red_amber/pulls)
241
+ - [Report bugs or suggest new features](https://github.com/red-data-tools/red_amber/issues)
242
+ - Fix bugs and [submit pull requests](https://github.com/red-data-tools/red_amber/pulls)
241
243
  - Write, clarify, or fix documentation
242
244
 
243
245
  ## License
data/benchmark/basic.yml CHANGED
@@ -43,7 +43,7 @@ benchmark:
43
43
  'B06: Pick by a block': |
44
44
  df.pick { keys.map { |key| key.end_with?('time') } }
45
45
 
46
- 'B07: Slice([]) by a index': |
46
+ 'B07: Slice([]) by an index': |
47
47
  df[877]
48
48
 
49
49
  'B08: Slice by indeces': |
@@ -39,7 +39,7 @@ This Code of Conduct applies within all community spaces, and also applies when
39
39
 
40
40
  ## Enforcement
41
41
 
42
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at 63298319+heronshoes@users.noreply.github.com. All complaints will be reviewed and investigated promptly and fairly.
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at heronshoes877@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
43
 
44
44
  All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
45
 
data/docker/.env ADDED
@@ -0,0 +1,4 @@
1
+ NB_USER=jovyan
2
+
3
+ TZ=
4
+ TOKEN=''
data/docker/Dockerfile ADDED
@@ -0,0 +1,66 @@
1
+ # x86-64/Ubuntu-22.04/python-3.10.9/lab-3.6.1/notebook-6.5.3/2023-03-13
2
+ ARG BASE_IMAGE_TAG=295612d3ade4
3
+
4
+ FROM jupyter/minimal-notebook:$BASE_IMAGE_TAG
5
+
6
+ USER root
7
+
8
+ RUN set -eux; \
9
+ apt update; \
10
+ apt install -y --no-install-recommends \
11
+ curl \
12
+ \
13
+ # For Apache Arrow
14
+ ca-certificates \
15
+ lsb-release \
16
+ \
17
+ # Ruby 3.0.2
18
+ ruby-dev \
19
+ \
20
+ # For iruby
21
+ libczmq-dev \
22
+ libzmq3-dev
23
+
24
+ # Apache Arrow
25
+ ARG ARROW_DEB_TMP=/tmp/apache-arrow-apt-source-latest.deb
26
+
27
+ RUN set -eux; \
28
+ apt update; \
29
+ curl -sfSL -o ${ARROW_DEB_TMP} \
30
+ https://apache.jfrog.io/artifactory/arrow/$(lsb_release --id --short | tr 'A-Z' 'a-z')/apache-arrow-apt-source-latest-$(lsb_release --codename --short).deb; \
31
+ apt install -y --no-install-recommends \
32
+ ${ARROW_DEB_TMP}; \
33
+ rm -f ${ARROW_DEB_TMP}; \
34
+ apt update; \
35
+ apt install -y \
36
+ libarrow-dev \
37
+ libarrow-glib-dev \
38
+ libparquet-dev \
39
+ libparquet-glib-dev \
40
+ libgirepository1.0-dev; \
41
+ rm -rf /var/lib/apt/lists/*
42
+
43
+ USER $NB_UID
44
+
45
+ WORKDIR $HOME
46
+
47
+ ENV PATH $HOME/.local/share/gem/bin:$HOME/.local/share/gem/ruby/3.0.0/bin:$PATH
48
+
49
+ # IRuby
50
+ RUN set -eux; \
51
+ gem install --user-install \
52
+ rake \
53
+ bundler \
54
+ iruby; \
55
+ iruby register --force
56
+
57
+ COPY --chown=$NB_UID:$NB_GID Gemfile $HOME
58
+ COPY --chown=$NB_UID:$NB_GID Gemfile.lock $HOME
59
+
60
+ ENV GEM_HOME=$HOME/.local/share/gem
61
+ ENV BUNDLE_PATH=$HOME/.local/share/gem
62
+ ENV BUNDLE_BIN=$HOME/.local/share/gem/bin
63
+
64
+ RUN bundle install --jobs=4
65
+
66
+ COPY --chown=$NB_UID:$NB_GID example $HOME
data/docker/Gemfile ADDED
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'irb'
6
+
7
+ gem 'numo-narray'
8
+ gem 'red-arrow', '~> 11.0.0'
9
+ gem 'red-arrow-numo-narray'
10
+ gem 'red-parquet', '~> 11.0.0'
11
+
12
+ gem 'red_amber', '>=0.4.0'
13
+ gem 'red-amber-view'
14
+ gem 'rover-df'
15
+
16
+ gem 'red-datasets'
17
+ gem 'red-datasets-arrow'
18
+
19
+ gem 'benchmark_driver'
20
+ gem 'benchmark-ips'
21
+ gem 'faker'
@@ -0,0 +1,80 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ benchmark-ips (2.12.0)
5
+ benchmark_driver (0.16.3)
6
+ bigdecimal (3.1.4)
7
+ concurrent-ruby (1.2.2)
8
+ csv (3.2.6)
9
+ extpp (0.1.1)
10
+ faker (3.1.1)
11
+ i18n (>= 1.8.11, < 2)
12
+ fiddle (1.1.1)
13
+ gio2 (4.1.2)
14
+ fiddle
15
+ gobject-introspection (= 4.1.2)
16
+ glib2 (4.1.2)
17
+ native-package-installer (>= 1.0.3)
18
+ pkg-config (>= 1.3.5)
19
+ gobject-introspection (4.1.2)
20
+ glib2 (= 4.1.2)
21
+ i18n (1.12.0)
22
+ concurrent-ruby (~> 1.0)
23
+ io-console (0.6.0)
24
+ irb (1.6.3)
25
+ reline (>= 0.3.0)
26
+ libui (0.0.15)
27
+ native-package-installer (1.1.5)
28
+ numo-narray (0.9.2.1)
29
+ pkg-config (1.5.1)
30
+ red-amber-view (0.0.1)
31
+ libui
32
+ red-arrow
33
+ red_amber
34
+ red-arrow (11.0.0)
35
+ bigdecimal (>= 3.1.0)
36
+ extpp (>= 0.1.1)
37
+ gio2 (>= 3.5.0)
38
+ native-package-installer
39
+ pkg-config
40
+ red-arrow-numo-narray (0.0.6)
41
+ numo-narray
42
+ red-arrow
43
+ red-datasets (0.1.5)
44
+ csv (>= 3.2.4)
45
+ rexml
46
+ rubyzip
47
+ red-datasets-arrow (0.0.3)
48
+ red-arrow
49
+ red-datasets (>= 0.0.3)
50
+ red-parquet (11.0.0)
51
+ red-arrow (= 11.0.0)
52
+ red_amber (0.4.1)
53
+ red-arrow (~> 11.0.0)
54
+ reline (0.3.2)
55
+ io-console (~> 0.5)
56
+ rexml (3.2.5)
57
+ rover-df (0.3.4)
58
+ numo-narray (>= 0.9.1.9)
59
+ rubyzip (2.3.2)
60
+
61
+ PLATFORMS
62
+ x86_64-linux
63
+
64
+ DEPENDENCIES
65
+ benchmark-ips
66
+ benchmark_driver
67
+ faker
68
+ irb
69
+ numo-narray
70
+ red-amber-view
71
+ red-arrow (~> 11.0.0)
72
+ red-arrow-numo-narray
73
+ red-datasets
74
+ red-datasets-arrow
75
+ red-parquet (~> 11.0.0)
76
+ red_amber (>= 0.4.1)
77
+ rover-df
78
+
79
+ BUNDLED WITH
80
+ 2.4.8
@@ -0,0 +1,21 @@
1
+ version: '3'
2
+
3
+ services:
4
+ minimal-redamber:
5
+ build:
6
+ context: .
7
+ dockerfile: Dockerfile
8
+ image: red_amber-minimal-notebook
9
+ container_name: red_amber-minimal-notebook
10
+ user: root
11
+ environment:
12
+ - GRANT_SUDO=yes
13
+ - NB_USER=$NB_USER
14
+ - CHOWN_HOME=yes
15
+ - TZ=$TZ
16
+ working_dir: /home/$NB_USER/work
17
+ ports:
18
+ - '8888:8888'
19
+ volumes:
20
+ - ./notebook:/home/$NB_USER/work
21
+ command: start-notebook.sh --NotebookApp.token=$TOKEN
data/docker/example ADDED
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $stderr.print "starting.\r"
5
+
6
+ require 'bundler/setup'
7
+
8
+ $stderr.print "starting..\r"
9
+ require 'red_amber'
10
+ include RedAmber
11
+
12
+ $stderr.print "starting...\r"
13
+ require 'datasets-arrow'
14
+
15
+ $stderr.print "reading penguins...\r"
16
+ penguins = DataFrame.new(Datasets::Penguins.new)
17
+
18
+ $stderr.print "reading diamonds...\r"
19
+ diamonds = DataFrame.new(Datasets::Diamonds.new)
20
+
21
+ $stderr.print "reading starwars...\r"
22
+ starwars = DataFrame.new(Datasets::Rdataset.new('dplyr', 'starwars'))
23
+
24
+ $stderr.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
+ $stderr.print "reading mtcars... \r"
29
+ mtcars = DataFrame.new(Datasets::Rdatasets.new('datasets', 'mtcars'))
30
+
31
+ $stderr.print "reading iris... \r"
32
+ iris = DataFrame.new(Datasets::Iris.new)
33
+
34
+ $stderr.print "reading band_members...\r"
35
+ band_members = DataFrame.new(Datasets::Rdatasets.new('dplyr', 'band_members'))
36
+
37
+ $stderr.print "reading band_instruments...\r"
38
+ band_instruments = DataFrame.new(Datasets::Rdatasets.new('dplyr', 'band_instruments'))
39
+
40
+ $stderr.print "reading band_instruments2...\r"
41
+ band_instruments2 = DataFrame.new(Datasets::Rdatasets.new('dplyr', 'band_instruments2'))
42
+
43
+ $stderr.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
+ $stderr.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
+ $stderr.print "reading general dataframe and subframes...\r"
62
+ dataframe = DataFrame.new(
63
+ x: [*1..6],
64
+ y: %w[A A B B B C],
65
+ z: [false, true, false, nil, true, false]
66
+ )
67
+ subframes = SubFrames.new(dataframe, [[0, 1], [2, 3, 4], [5]])
68
+
69
+ # Welcome to RedAmber example!
70
+ # This environment will offer these pre-loaded datasets:
71
+ # penguins, diamonds, iris, starwars, simpsons_paradox_covid,
72
+ # mtcars, band_members, band_instruments, band_instruments2
73
+ # (original) import_cars, comecome, dataframe, subframes
74
+ binding.irb