daru_lite 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/workflows/ci.yml +20 -0
- data/README.md +19 -115
- data/daru_lite.gemspec +1 -0
- data/lib/daru_lite/dataframe.rb +5 -3
- data/lib/daru_lite/version.rb +1 -1
- data/spec/dataframe_spec.rb +55 -9
- metadata +18 -3
- data/.github/ISSUE_TEMPLATE.md +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f11fb1ea9fb6c3f43f5f8267338ed4cc81fde2f60bcc82fd6eec6e30b5d87d5
|
4
|
+
data.tar.gz: e8a833062efdf095672da6684d3971a5e1eafa482b658ae7436061ad4d9ff1c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25dc59ffa9fb012693cf7bd611e19d134d4f003ee3ff5c642a574cb4bfebc5001a8aacd8b42982001b585233b370017e440c62be9dc6389f371423edc36c058b
|
7
|
+
data.tar.gz: f7373e8a86deb1f766cfb56f759cce92accfad2b571dac138d6d2eb54c2bb746b9cb6a11854891ba4137740208310837cb06edef4680cc2d4319260b12a1c917
|
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Describe the bug**
|
11
|
+
A clear and concise description of what the bug is.
|
12
|
+
|
13
|
+
**To Reproduce**
|
14
|
+
Steps to reproduce the behavior:
|
15
|
+
1. Go to '...'
|
16
|
+
2. Click on '....'
|
17
|
+
3. Scroll down to '....'
|
18
|
+
4. See error
|
19
|
+
|
20
|
+
**Expected behavior**
|
21
|
+
A clear and concise description of what you expected to happen.
|
22
|
+
|
23
|
+
**Screenshots**
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
25
|
+
|
26
|
+
**Desktop (please complete the following information):**
|
27
|
+
- OS: [e.g. iOS]
|
28
|
+
- Browser [e.g. chrome, safari]
|
29
|
+
- Version [e.g. 22]
|
30
|
+
|
31
|
+
**Smartphone (please complete the following information):**
|
32
|
+
- Device: [e.g. iPhone6]
|
33
|
+
- OS: [e.g. iOS8.1]
|
34
|
+
- Browser [e.g. stock browser, safari]
|
35
|
+
- Version [e.g. 22]
|
36
|
+
|
37
|
+
**Additional context**
|
38
|
+
Add any other context about the problem here.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea for this project
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
12
|
+
|
13
|
+
**Describe the solution you'd like**
|
14
|
+
A clear and concise description of what you want to happen.
|
15
|
+
|
16
|
+
**Describe alternatives you've considered**
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
18
|
+
|
19
|
+
**Additional context**
|
20
|
+
Add any other context or screenshots about the feature request here.
|
data/.github/workflows/ci.yml
CHANGED
@@ -1,6 +1,15 @@
|
|
1
1
|
name: CI
|
2
2
|
on: [push]
|
3
3
|
|
4
|
+
env:
|
5
|
+
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
|
6
|
+
# `github.ref` points to the *merge commit* when running tests on a pull request, which will be a commit
|
7
|
+
# that doesn't exists in our code base. Since this workflow triggers from a PR, we use the HEAD SHA instead.
|
8
|
+
#
|
9
|
+
# NOTE: These are both used by Code Climate (cc-test-reporter).
|
10
|
+
GIT_COMMIT_SHA: ${{github.event.pull_request.head.sha}}
|
11
|
+
GIT_BRANCH: ${{github.head_ref}}
|
12
|
+
|
4
13
|
jobs:
|
5
14
|
lint:
|
6
15
|
runs-on: ubuntu-latest
|
@@ -29,5 +38,16 @@ jobs:
|
|
29
38
|
with:
|
30
39
|
ruby-version: ${{ matrix.ruby-version }}
|
31
40
|
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
41
|
+
- name: "Download cc-test-reporter from codeclimate.com"
|
42
|
+
run: |
|
43
|
+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
44
|
+
chmod +x ./cc-test-reporter
|
45
|
+
- name: "Report to Code Climate that we will send a coverage report."
|
46
|
+
run: ./cc-test-reporter before-build
|
32
47
|
- name: Run tests
|
33
48
|
run: bundle exec rspec
|
49
|
+
- name: Upload code coverage to Code Climate
|
50
|
+
run: |
|
51
|
+
./cc-test-reporter after-build \
|
52
|
+
--coverage-input-type simplecov \
|
53
|
+
./coverage/.resultset.json
|
data/README.md
CHANGED
@@ -1,50 +1,21 @@
|
|
1
|
-
# daru - Data Analysis in RUby
|
1
|
+
# daru Lite - Data Analysis in RUby Lite
|
2
2
|
|
3
|
-
|
4
|
-
[![Build Status](https://travis-ci.org/SciRuby/daru.svg?branch=master)](https://travis-ci.org/SciRuby/daru)
|
5
|
-
[![Gitter](https://badges.gitter.im/v0dro/daru.svg)](https://gitter.im/v0dro/daru?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
6
|
-
[![Open Source Helpers](https://www.codetriage.com/sciruby/daru/badges/users.svg)](https://www.codetriage.com/sciruby/daru)
|
3
|
+
Simple, straightforward DataFrames for Ruby
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
daru makes it easy and intuitive to process data predominantly through 2 data structures:
|
13
|
-
`DaruLite::DataFrame` and `DaruLite::Vector`. Written in pure Ruby works with all ruby implementations.
|
14
|
-
Tested with MRI 2.5.1 and 2.7.1.
|
15
|
-
|
16
|
-
## daru plugin gems
|
17
|
-
|
18
|
-
- **[daru-view](https://github.com/SciRuby/daru-view)**
|
19
|
-
|
20
|
-
daru-view is for easy and interactive plotting in web application & IRuby
|
21
|
-
notebook. It can work in any Ruby web application frameworks like Rails, Sinatra, Nanoc and hopefully in others too.
|
22
|
-
|
23
|
-
Articles/Blogs, that summarize powerful features of daru-view:
|
24
|
-
|
25
|
-
* [GSoC 2017 daru-view](http://sciruby.com/blog/2017/09/01/gsoc-2017-data-visualization-using-daru-view/)
|
26
|
-
* [GSoC 2018 Progress Report](https://github.com/SciRuby/daru-view/wiki/GSoC-2018---Progress-Report)
|
27
|
-
* [HighCharts Official blog post regarding daru-view](https://www.highcharts.com/blog/post/i-am-ruby-developer-how-can-i-use-highcharts/)
|
28
|
-
|
29
|
-
- **[daru-io](https://github.com/SciRuby/daru-io)**
|
30
|
-
|
31
|
-
This gem extends support for many Import and Export methods of `DaruLite::DataFrame`. This gem is intended to help Rubyists who are into Data Analysis or Web Development, by serving as a general purpose conversion library that takes input in one format (say, JSON) and converts it another format (say, Avro) while also making it incredibly easy to getting started on analyzing data with daru. One can read more in [SciRuby/blog/daru-io](http://sciruby.com/blog/2017/08/29/gsoc-2017-support-to-import-export-of-more-formats/).
|
5
|
+
[![Build Status](https://github.com/pollandroll/daru_lite/actions/workflows/build.yml/badge.svg)](https://github.com/pollandroll/daru_lite/actions)
|
6
|
+
[![Gem Version](https://img.shields.io/gem/v/daru_lite.svg)](https://rubygems.org/gems/daru_lite)
|
7
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/f87d4ed10b5731e50184/maintainability)](https://codeclimate.com/github/pollandroll/daru_lite/maintainability)
|
8
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/f87d4ed10b5731e50184/test_coverage)](https://codeclimate.com/github/pollandroll/daru_lite/test_coverage)
|
32
9
|
|
10
|
+
## Introduction
|
33
11
|
|
34
|
-
|
12
|
+
daru Lite is a library for data analysis and manipulation in Ruby.
|
35
13
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
* Singly and hierarchically indexed data structures.
|
42
|
-
* Flexible and intuitive API for manipulation and analysis of data.
|
43
|
-
* Easy plotting, statistics and arithmetic.
|
44
|
-
* Plentiful iterators.
|
45
|
-
* Easy splitting, aggregation and grouping of data.
|
46
|
-
* Quickly reducing data with pivot tables for quick data summary.
|
47
|
-
* Import and export data from and to Excel, CSV, SQL Databases, ActiveRecord and plain text files.
|
14
|
+
This project started as fork of [Daru](https://github.com/SciRuby/daru) with the objective to provide :
|
15
|
+
- a simple and yet powerfull interface to manipulate data using DataFrames
|
16
|
+
- a API consistent with the one historically provided by daru
|
17
|
+
- a focus on the core features around data manipulation, droped several cumbersome daru dependencies and the associated features : notably N-Matrix, GSL, R, imagemagick and all plotting libraries. The current project has no major dependencies
|
18
|
+
- build a future-proof library that can safely be used in production
|
48
19
|
|
49
20
|
## Installation
|
50
21
|
|
@@ -52,62 +23,14 @@ This gem extends support for many Import and Export methods of `DaruLite::DataFr
|
|
52
23
|
$ gem install daru_lite
|
53
24
|
```
|
54
25
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
* [Overview of most daru functions](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Daru%20Demo.ipynb)
|
60
|
-
* [Basic Creation of Vectors and DataFrame](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Creation%20of%20Vector%20and%20DataFrame.ipynb)
|
61
|
-
* [Detailed Usage of DaruLite::Vector](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Usage%20of%20Vector.ipynb)
|
62
|
-
* [Detailed Usage of DaruLite::DataFrame](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Usage%20of%20DataFrame.ipynb)
|
63
|
-
* [Searching and combining data in daru](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Searching%20and%20Combining%20Data.ipynb)
|
64
|
-
* [Grouping, Splitting and Pivoting Data](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Grouping%2C%20Splitting%20and%20Pivoting.ipynb)
|
65
|
-
* [Usage of Categorical Data](http://nbviewer.jupyter.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Categorical%20Data/Categorical%20Data.ipynb)
|
66
|
-
|
67
|
-
#### Visualization
|
68
|
-
* [Visualizing Data With DaruLite::DataFrame](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Visualization/Visualizing%20data%20with%20daru%20DataFrame.ipynb)
|
69
|
-
* [Plotting using GnuplotRB](http://nbviewer.jupyter.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Plotting/Gnuplotrb.ipynb)
|
70
|
-
* [Vector plotting with Gruff](http://nbviewer.jupyter.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Plotting/Gruff%20Vector.ipynb)
|
71
|
-
* [DataFrame plotting with Gruff](http://nbviewer.jupyter.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Plotting/Gruff%20DataFrame.ipynb)
|
72
|
-
|
73
|
-
#### Notebooks on Time series
|
74
|
-
|
75
|
-
* [Basic Time Series](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Basic%20Time%20Series.ipynb)
|
76
|
-
* [Time Series Analysis and Plotting](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Time%20Series%20Functions.ipynb)
|
77
|
-
|
78
|
-
#### Notebooks on Indexing
|
79
|
-
* [Indexing in Vector](http://nbviewer.jupyter.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Categorical%20Data/Indexing%20in%20Vector.ipynb)
|
80
|
-
* [Indexing in DataFrame](http://nbviewer.jupyter.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Categorical%20Data/Indexing%20in%20DataFrame.ipynb)
|
81
|
-
|
82
|
-
### Case Studies
|
83
|
-
|
84
|
-
* [Logistic Regression Analysis with daru and statsample-glm](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Logistic%20Regression%20with%20daru%20and%20statsample-glm.ipynb)
|
85
|
-
* [Finding and Plotting most heard artists from a Last.fm dataset](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Finding%20and%20plotting%20the%20most%20heard%20artists%20on%20last%20fm.ipynb)
|
86
|
-
* [Analyzing baby names with daru](http://nbviewer.ipython.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Analyzing%20baby%20names/Use%20Case%20-%20Daru%20for%20analyzing%20baby%20names%20data.ipynb)
|
87
|
-
* [Example usage of Categorical Data](http://nbviewer.jupyter.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Categorical%20Data/examples/%5BExample%5D%20Categorical%20Data.ipynb)
|
88
|
-
* [Example usage of Categorical Index](http://nbviewer.jupyter.org/github/SciRuby/sciruby-notebooks/blob/master/Data%20Analysis/Categorical%20Data/examples/%5BExample%5D%20Categorical%20Index.ipynb)
|
89
|
-
|
90
|
-
## Blog Posts
|
91
|
-
|
92
|
-
* [Data Analysis in RUby: Basic data manipulation and plotting](http://v0dro.github.io/blog/2014/11/25/data-analysis-in-ruby-basic-data-manipulation-and-plotting/)
|
93
|
-
* [Data Analysis in RUby: Splitting, sorting, aggregating data and data types](http://v0dro.github.io/blog/2015/02/24/data-analysis-in-ruby-part-2/)
|
94
|
-
* [Finding and Combining data in daru](http://v0dro.github.io/blog/2015/08/03/finding-and-combining-data-in-daru/)
|
95
|
-
* [Introduction to analyzing datasets with daru library](http://gafur.me/2018/02/05/analysing-datasets-with-daru-library.html)
|
96
|
-
|
97
|
-
### Time series
|
98
|
-
|
99
|
-
* [Analysis of Time Series in daru](http://v0dro.github.io/blog/2015/07/31/analysis-of-time-series-in-daru/)
|
100
|
-
* [Date Offsets in Daru](http://v0dro.github.io/blog/2015/07/27/date-offsets-in-daru/)
|
101
|
-
|
102
|
-
### Categorical Data
|
103
|
-
|
104
|
-
* [Categorical Index](http://lokeshh.github.io/gsoc2016/blog/2016/06/14/categorical-index/)
|
105
|
-
* [Categorical Data](http://lokeshh.github.io/gsoc2016/blog/2016/06/21/categorical-data/)
|
106
|
-
* [Visualization with Categorical Data](http://lokeshh.github.io/gsoc2016/blog/2016/07/02/visualization/)
|
26
|
+
or add daru Lite to your Gemfile:
|
27
|
+
```console
|
28
|
+
$ bundle add daru_lite
|
29
|
+
```
|
107
30
|
|
108
31
|
## Basic Usage
|
109
32
|
|
110
|
-
daru exposes two major data structures: `DataFrame` and `Vector`. The Vector is a basic 1-D structure corresponding to a labelled Array, while the `DataFrame` - daru's primary data structure - is 2-D spreadsheet-like structure for manipulating and storing data sets.
|
33
|
+
daru Lite exposes two major data structures: `DataFrame` and `Vector`. The Vector is a basic 1-D structure corresponding to a labelled Array, while the `DataFrame` - daru's primary data structure - is 2-D spreadsheet-like structure for manipulating and storing data sets.
|
111
34
|
|
112
35
|
Basic DataFrame intitialization.
|
113
36
|
|
@@ -194,25 +117,6 @@ data_frame.where(
|
|
194
117
|
```
|
195
118
|
![con1](images/con1.png)
|
196
119
|
|
197
|
-
*Plotting*
|
198
|
-
|
199
|
-
daru supports plotting out of the box with [gnuplotrb](https://github.com/SciRuby/gnuplotrb).
|
200
|
-
|
201
120
|
## Documentation
|
202
121
|
|
203
|
-
Docs can be found [here](http://www.rubydoc.info/gems/
|
204
|
-
|
205
|
-
## Contributing
|
206
|
-
|
207
|
-
Pick a feature from the Roadmap or the issue tracker or think of your own and send me a Pull Request!
|
208
|
-
|
209
|
-
For details see [CONTRIBUTING](https://github.com/SciRuby/daru/blob/master/CONTRIBUTING.md).
|
210
|
-
|
211
|
-
## Acknowledgements
|
212
|
-
|
213
|
-
* Google and the Ruby Science Foundation for the Google Summer of Code 2016 grant for speed enhancements and implementation of support for categorical data. Special thanks to [@lokeshh](https://github.com/lokeshh), [@zverok](https://github.com/zverok) and [@agisga](https://github.com/agisga) for their efforts.
|
214
|
-
* Google and the Ruby Science Foundation for the Google Summer of Code 2015 grant for further developing daru and integrating it with other ruby gems.
|
215
|
-
* Thank you [last.fm](http://www.last.fm/) for making user data accessible to the public.
|
216
|
-
|
217
|
-
Copyright (c) 2015, Sameer Deshmukh
|
218
|
-
All rights reserved
|
122
|
+
Docs can be found [here](http://www.rubydoc.info/gems/daru_lite).
|
data/daru_lite.gemspec
CHANGED
@@ -47,6 +47,7 @@ Gem::Specification.new do |spec|
|
|
47
47
|
spec.add_development_dependency 'rubocop-rspec', '~> 2.25'
|
48
48
|
spec.add_development_dependency 'ruby-prof', '~> 1.7.0'
|
49
49
|
spec.add_development_dependency 'simplecov', '~> 0.22.0'
|
50
|
+
spec.add_development_dependency 'simplecov_json_formatter', '~> 0.1.4'
|
50
51
|
spec.add_development_dependency 'spreadsheet', '~> 1.3.0'
|
51
52
|
spec.add_development_dependency 'sqlite3', '~> 1.7.2'
|
52
53
|
# issue : https://github.com/SciRuby/daru/issues/493 occured
|
data/lib/daru_lite/dataframe.rb
CHANGED
@@ -1151,8 +1151,7 @@ module DaruLite
|
|
1151
1151
|
# # 1 5 2
|
1152
1152
|
# # 2 6 3
|
1153
1153
|
def order=(order_array)
|
1154
|
-
raise ArgumentError, 'Invalid order' unless
|
1155
|
-
order_array.sort == vectors.to_a.sort
|
1154
|
+
raise ArgumentError, 'Invalid order' unless vectors.to_a.tally == order_array.tally
|
1156
1155
|
|
1157
1156
|
initialize(to_h, order: order_array)
|
1158
1157
|
end
|
@@ -2204,7 +2203,10 @@ module DaruLite
|
|
2204
2203
|
# Pretty print in a nice table format for the command line (irb/pry/iruby)
|
2205
2204
|
def inspect(spacing = DaruLite.spacing, threshold = DaruLite.max_rows)
|
2206
2205
|
name_part = @name ? ": #{@name} " : ''
|
2207
|
-
spacing = [
|
2206
|
+
spacing = [
|
2207
|
+
headers.to_a.map { |header| header.try(:length) || header.to_s.length }.max,
|
2208
|
+
spacing
|
2209
|
+
].max
|
2208
2210
|
|
2209
2211
|
"#<#{self.class}#{name_part}(#{nrows}x#{ncols})>#{$INPUT_RECORD_SEPARATOR}" +
|
2210
2212
|
Formatters::Table.format(
|
data/lib/daru_lite/version.rb
CHANGED
data/spec/dataframe_spec.rb
CHANGED
@@ -2717,6 +2717,23 @@ describe DaruLite::DataFrame do
|
|
2717
2717
|
context 'wrong vectors' do
|
2718
2718
|
it { expect { df.order = [:a, :b, 'b'] }.to raise_error }
|
2719
2719
|
end
|
2720
|
+
|
2721
|
+
context 'different vector types' do
|
2722
|
+
subject { df.order = new_order }
|
2723
|
+
|
2724
|
+
let(:df) do
|
2725
|
+
DaruLite::DataFrame.new({
|
2726
|
+
'a' => [1,2,3],
|
2727
|
+
b: [4,5,6],
|
2728
|
+
3 => [5,7,9]
|
2729
|
+
}, order: ['a', :b, 3])
|
2730
|
+
end
|
2731
|
+
let(:new_order) { [3, 'a', :b] }
|
2732
|
+
|
2733
|
+
it "sets correct order" do
|
2734
|
+
expect { subject }.to change { df.vectors.to_a }.to(new_order)
|
2735
|
+
end
|
2736
|
+
end
|
2720
2737
|
end
|
2721
2738
|
|
2722
2739
|
context "#vectors=" do
|
@@ -4021,6 +4038,18 @@ describe DaruLite::DataFrame do
|
|
4021
4038
|
}.unindent}
|
4022
4039
|
end
|
4023
4040
|
|
4041
|
+
context 'with integers as vectors names' do
|
4042
|
+
let(:df) { DaruLite::DataFrame.new({ 1 => [1,2,3], b: [3,4,5], c: [6,7,8] }, name: 'test')}
|
4043
|
+
|
4044
|
+
it { is_expected.to eq %Q{
|
4045
|
+
|#<DaruLite::DataFrame: test (3x3)>
|
4046
|
+
| 1 b c
|
4047
|
+
| 0 1 3 6
|
4048
|
+
| 1 2 4 7
|
4049
|
+
| 2 3 5 8
|
4050
|
+
}.unindent}
|
4051
|
+
end
|
4052
|
+
|
4024
4053
|
context 'very long' do
|
4025
4054
|
let(:df) { DaruLite::DataFrame.new({a: [1,1,1]*20, b: [1,1,1]*20, c: [1,1,1]*20}, name: 'test')}
|
4026
4055
|
it { is_expected.to eq %Q{
|
@@ -4305,17 +4334,34 @@ describe DaruLite::DataFrame do
|
|
4305
4334
|
subject { df.rotate_vectors(-1) }
|
4306
4335
|
|
4307
4336
|
context "several vectors in the dataframe" do
|
4308
|
-
|
4309
|
-
|
4310
|
-
|
4311
|
-
|
4312
|
-
|
4313
|
-
|
4337
|
+
context 'all vector names are the same type' do
|
4338
|
+
let(:df) do
|
4339
|
+
DaruLite::DataFrame.new({
|
4340
|
+
a: [1,2,3],
|
4341
|
+
b: [4,5,6],
|
4342
|
+
total: [5,7,9]
|
4343
|
+
})
|
4344
|
+
end
|
4345
|
+
let(:new_order) { [:total, :a, :b] }
|
4346
|
+
|
4347
|
+
it "return the dataframe with the position of the last vector change to first" do
|
4348
|
+
expect(subject.vectors.to_a).to eq(new_order)
|
4349
|
+
end
|
4314
4350
|
end
|
4315
|
-
let(:new_order) { [:total, :a, :b] }
|
4316
4351
|
|
4317
|
-
|
4318
|
-
|
4352
|
+
context 'vector names are of different types' do
|
4353
|
+
let(:df) do
|
4354
|
+
DaruLite::DataFrame.new({
|
4355
|
+
'a' => [1,2,3],
|
4356
|
+
b: [4,5,6],
|
4357
|
+
3 => [5,7,9]
|
4358
|
+
})
|
4359
|
+
end
|
4360
|
+
let(:new_order) { [3, 'a', :b] }
|
4361
|
+
|
4362
|
+
it "return the dataframe with the position of the last vector change to first" do
|
4363
|
+
expect(subject.vectors.to_a).to eq(new_order)
|
4364
|
+
end
|
4319
4365
|
end
|
4320
4366
|
end
|
4321
4367
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daru_lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Naude-Filonnière
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2024-02-
|
15
|
+
date: 2024-02-26 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: activerecord
|
@@ -286,6 +286,20 @@ dependencies:
|
|
286
286
|
- - "~>"
|
287
287
|
- !ruby/object:Gem::Version
|
288
288
|
version: 0.22.0
|
289
|
+
- !ruby/object:Gem::Dependency
|
290
|
+
name: simplecov_json_formatter
|
291
|
+
requirement: !ruby/object:Gem::Requirement
|
292
|
+
requirements:
|
293
|
+
- - "~>"
|
294
|
+
- !ruby/object:Gem::Version
|
295
|
+
version: 0.1.4
|
296
|
+
type: :development
|
297
|
+
prerelease: false
|
298
|
+
version_requirements: !ruby/object:Gem::Requirement
|
299
|
+
requirements:
|
300
|
+
- - "~>"
|
301
|
+
- !ruby/object:Gem::Version
|
302
|
+
version: 0.1.4
|
289
303
|
- !ruby/object:Gem::Dependency
|
290
304
|
name: spreadsheet
|
291
305
|
requirement: !ruby/object:Gem::Requirement
|
@@ -342,7 +356,8 @@ executables: []
|
|
342
356
|
extensions: []
|
343
357
|
extra_rdoc_files: []
|
344
358
|
files:
|
345
|
-
- ".github/ISSUE_TEMPLATE.md"
|
359
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
360
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
346
361
|
- ".github/workflows/ci.yml"
|
347
362
|
- ".gitignore"
|
348
363
|
- ".rspec"
|
data/.github/ISSUE_TEMPLATE.md
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
Heya! We are glad you are going to contribute to Daru by creating an issue, and kindly ask you to
|
2
|
-
follow the simple rules:
|
3
|
-
|
4
|
-
1. If it is a bug report, please provide a **self-containing** Ruby code for reproducing the bug.
|
5
|
-
This means if Daru contributors just copy-paste the code from issue into `this-is-bug.rb` and run
|
6
|
-
`ruby this-is-bug.rb`, it will be reproduced. If the bug is hard to spot (e.g. it is not some
|
7
|
-
`NoMethodError`, but the differences in data structure), please show it with comment in code or
|
8
|
-
plain text in the issue.
|
9
|
-
2. If it is a feature request, try to do the following (if possible):
|
10
|
-
* show how new feature will work with small code example;
|
11
|
-
* explain the use case (if it is not 200% obvious);
|
12
|
-
* if you are aware of it, show how it works in pandas and/or R.
|
13
|
-
3. If it is just a question ("how to do this or that" or "why Daru does this or that") feel free to
|
14
|
-
write it in any form that is convenient to you, but remember code examples and use cases are always
|
15
|
-
welcome.
|
16
|
-
|
17
|
-
Thanks! And please remove this text when finished with your issue description :)
|
18
|
-
|