daru 0.2.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +6 -9
- data/CONTRIBUTING.md +12 -16
- data/History.md +17 -0
- data/README.md +3 -2
- data/daru.gemspec +9 -17
- data/lib/daru.rb +1 -1
- data/lib/daru/configuration.rb +34 -0
- data/lib/daru/core/group_by.rb +23 -22
- data/lib/daru/core/query.rb +16 -0
- data/lib/daru/dataframe.rb +37 -4
- data/lib/daru/date_time/index.rb +6 -5
- data/lib/daru/date_time/offsets.rb +8 -0
- data/lib/daru/formatters/table.rb +2 -5
- data/lib/daru/io/io.rb +16 -8
- data/lib/daru/vector.rb +42 -0
- data/lib/daru/version.rb +1 -1
- data/spec/accessors/gsl_wrapper_spec.rb +38 -35
- data/spec/accessors/nmatrix_wrapper_spec.rb +25 -22
- data/spec/core/merge_spec.rb +1 -1
- data/spec/core/query_spec.rb +10 -0
- data/spec/dataframe_spec.rb +80 -0
- data/spec/date_time/date_time_index_helper_spec.rb +72 -0
- data/spec/date_time/offsets_spec.rb +14 -0
- data/spec/fixtures/matrix_test.csv +55 -55
- data/spec/fixtures/test_xls.xls +0 -0
- data/spec/fixtures/test_xls_2.xls +0 -0
- data/spec/io/io_spec.rb +33 -0
- data/spec/maths/arithmetic/dataframe_spec.rb +1 -1
- data/spec/spec_helper.rb +8 -6
- data/spec/vector_spec.rb +29 -0
- metadata +19 -28
@@ -140,6 +140,20 @@ describe Offsets do
|
|
140
140
|
DateTime.new(2012,2,3,12,4,18))
|
141
141
|
end
|
142
142
|
end
|
143
|
+
|
144
|
+
context "#==" do
|
145
|
+
it 'equals the same offset' do
|
146
|
+
expect(Offsets::Second.new(5)).to eq(Offsets::Second.new(5))
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'does equal a different offset' do
|
150
|
+
expect(Offsets::Second.new(5)).to_not eq(Offsets::Second.new(4))
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'equals offets with the same period' do
|
154
|
+
expect(Offsets::Second.new(60)).to eq(Offsets::Minute.new())
|
155
|
+
end
|
156
|
+
end
|
143
157
|
end
|
144
158
|
|
145
159
|
describe Minute do
|
@@ -1,100 +1,100 @@
|
|
1
|
-
image_resolution
|
2
|
-
6.55779 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,4262.65,0,0,0,1
|
1
|
+
image_resolution true_transform mls
|
2
|
+
6.55779 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,4262.65,0,0,0,1 0
|
3
3
|
2.14746 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,1278.86,0,0,0,1 0
|
4
4
|
8.31104 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,5448.81,0,0,0,1 0
|
5
5
|
3.47872 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,2179.52,0,0,0,1 0
|
6
|
-
4.16725 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,2645.34,0,0,0,1
|
7
|
-
5.79983 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,3749.86,0,0,0,1
|
8
|
-
1.9058
|
9
|
-
1.9058
|
10
|
-
4.11806 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,2612.06,0,0,0,1
|
11
|
-
6.26622 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,4065.39,0,0,0,1
|
6
|
+
4.16725 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,2645.34,0,0,0,1 0
|
7
|
+
5.79983 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,3749.86,0,0,0,1 0
|
8
|
+
1.9058 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1115.36,0,0,0,1 0
|
9
|
+
1.9058 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1115.36,0,0,0,1 0
|
10
|
+
4.11806 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,2612.06,0,0,0,1 0
|
11
|
+
6.26622 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,4065.39,0,0,0,1 0
|
12
12
|
2.57805 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,1570.18,0,0,0,1 0
|
13
|
-
4.76151 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,3047.39,0,0,0,1
|
14
|
-
7.11002 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,4636.26,0,0,0,1
|
15
|
-
5.40811 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,3484.84,0,0,0,1
|
13
|
+
4.76151 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,3047.39,0,0,0,1 0
|
14
|
+
7.11002 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,4636.26,0,0,0,1 0
|
15
|
+
5.40811 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,3484.84,0,0,0,1 0
|
16
16
|
8.19567 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,5370.75,0,0,0,1 0
|
17
|
-
3.47872 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,2179.52,0,0,0,1
|
18
|
-
2.91762 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1799.91,0,0,0,1
|
17
|
+
3.47872 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,2179.52,0,0,0,1 0
|
18
|
+
2.91762 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1799.91,0,0,0,1 0
|
19
19
|
4.76151 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,3047.39,0,0,0,1 0
|
20
|
-
8.19567 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,5370.75,0,0,0,1
|
20
|
+
8.19567 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,5370.75,0,0,0,1 0
|
21
21
|
2.91762 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,1799.91,0,0,0,1 0
|
22
22
|
6.26622 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,4065.39,0,0,0,1 0
|
23
23
|
4.16725 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,2645.34,0,0,0,1 0
|
24
|
-
3.78516 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,2386.84,0,0,0,1
|
24
|
+
3.78516 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,2386.84,0,0,0,1 0
|
25
25
|
3.78516 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,2386.84,0,0,0,1 0
|
26
|
-
7.47603 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,4883.89,0,0,0,1
|
26
|
+
7.47603 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,4883.89,0,0,0,1 0
|
27
27
|
5.79983 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,3749.86,0,0,0,1 0
|
28
|
-
2.57805 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1570.18,0,0,0,1
|
28
|
+
2.57805 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1570.18,0,0,0,1 0
|
29
29
|
8.31104 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,5448.81,0,0,0,1 0
|
30
|
-
1.77097 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1024.14,0,0,0,1
|
31
|
-
5.9596
|
30
|
+
1.77097 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1024.14,0,0,0,1 0
|
31
|
+
5.9596 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,3857.95,0,0,0,1 0
|
32
32
|
5.40811 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,3484.84,0,0,0,1 0
|
33
33
|
4.16725 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,2645.34,0,0,0,1 0
|
34
34
|
7.11002 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,4636.26,0,0,0,1 0
|
35
|
-
7.47603 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,4883.89,0,0,0,1
|
36
|
-
13.6304 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,9047.63,0,0,0,1
|
37
|
-
5.9596
|
35
|
+
7.47603 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,4883.89,0,0,0,1 0
|
36
|
+
13.6304 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,9047.63,0,0,0,1 0
|
37
|
+
5.9596 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,3857.95,0,0,0,1 0
|
38
38
|
4.76151 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,3047.39,0,0,0,1 0
|
39
39
|
5.40811 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,3484.84,0,0,0,1 0
|
40
|
-
12.4066 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,8219.63,0,0,0,1
|
40
|
+
12.4066 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,8219.63,0,0,0,1 0
|
41
41
|
5.79983 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,3749.86,0,0,0,1 0
|
42
|
-
7.11002 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,4636.26,0,0,0,1
|
42
|
+
7.11002 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,4636.26,0,0,0,1 0
|
43
43
|
7.11002 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,4636.26,0,0,0,1 0
|
44
44
|
2.58728 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,1576.42,0,0,0,1 0
|
45
|
-
12.4066 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,8219.63,0,0,0,1
|
46
|
-
3.78516 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,2386.84,0,0,0,1
|
45
|
+
12.4066 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,8219.63,0,0,0,1 0
|
46
|
+
3.78516 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,2386.84,0,0,0,1 0
|
47
47
|
2.58728 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,1576.42,0,0,0,1 0
|
48
48
|
5.03378 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,3231.59,0,0,0,1 0
|
49
|
-
5.40811 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,3484.84,0,0,0,1
|
50
|
-
6.26622 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,4065.39,0,0,0,1
|
51
|
-
2.58728 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1576.42,0,0,0,1
|
49
|
+
5.40811 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,3484.84,0,0,0,1 0
|
50
|
+
6.26622 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,4065.39,0,0,0,1 0
|
51
|
+
2.58728 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1576.42,0,0,0,1 0
|
52
52
|
2.91762 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,1799.91,0,0,0,1 0
|
53
|
-
5.9596
|
53
|
+
5.9596 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,3857.95,0,0,0,1 0
|
54
54
|
1.77097 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,1024.14,0,0,0,1 0
|
55
55
|
7.47603 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,4883.89,0,0,0,1 0
|
56
|
-
5.03378 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,3231.59,0,0,0,1
|
57
|
-
1.81745 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1055.59,0,0,0,1
|
58
|
-
1.77097 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1024.14,0,0,0,1
|
59
|
-
2.14746 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1278.86,0,0,0,1
|
56
|
+
5.03378 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,3231.59,0,0,0,1 0
|
57
|
+
1.81745 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1055.59,0,0,0,1 0
|
58
|
+
1.77097 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1024.14,0,0,0,1 0
|
59
|
+
2.14746 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1278.86,0,0,0,1 0
|
60
60
|
8.19567 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,5370.75,0,0,0,1 0
|
61
|
-
2.91762 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1799.91,0,0,0,1
|
62
|
-
1.81745 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1055.59,0,0,0,1
|
63
|
-
8.31104 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,5448.81,0,0,0,1
|
61
|
+
2.91762 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1799.91,0,0,0,1 0
|
62
|
+
1.81745 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1055.59,0,0,0,1 0
|
63
|
+
8.31104 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,5448.81,0,0,0,1 0
|
64
64
|
1.81745 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,1055.59,0,0,0,1 0
|
65
65
|
1.77097 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,1024.14,0,0,0,1 0
|
66
66
|
2.57805 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,1570.18,0,0,0,1 0
|
67
|
-
5.03378 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,3231.59,0,0,0,1
|
67
|
+
5.03378 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,3231.59,0,0,0,1 0
|
68
68
|
6.55779 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,4262.65,0,0,0,1 0
|
69
|
-
6.55779 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,4262.65,0,0,0,1
|
70
|
-
3.47872 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,2179.52,0,0,0,1
|
71
|
-
4.11806 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,2612.06,0,0,0,1
|
69
|
+
6.55779 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,4262.65,0,0,0,1 0
|
70
|
+
3.47872 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,2179.52,0,0,0,1 0
|
71
|
+
4.11806 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,2612.06,0,0,0,1 0
|
72
72
|
6.55779 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,4262.65,0,0,0,1 0
|
73
|
-
8.31104 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,5448.81,0,0,0,1
|
73
|
+
8.31104 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,5448.81,0,0,0,1 0
|
74
74
|
2.14746 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,1278.86,0,0,0,1 0
|
75
75
|
2.32632 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,1399.86,0,0,0,1 0
|
76
|
-
1.9058
|
76
|
+
1.9058 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,1115.36,0,0,0,1 0
|
77
77
|
6.26622 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,4065.39,0,0,0,1 0
|
78
78
|
2.32632 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,1399.86,0,0,0,1 0
|
79
79
|
7.47603 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,4883.89,0,0,0,1 0
|
80
80
|
4.11806 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,2612.06,0,0,0,1 0
|
81
|
-
13.6304 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,9047.63,0,0,0,1
|
82
|
-
2.14746 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1278.86,0,0,0,1
|
83
|
-
1.9058
|
81
|
+
13.6304 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,9047.63,0,0,0,1 0
|
82
|
+
2.14746 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1278.86,0,0,0,1 0
|
83
|
+
1.9058 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,1115.36,0,0,0,1 0
|
84
84
|
5.03378 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,3231.59,0,0,0,1 0
|
85
|
-
5.9596
|
86
|
-
4.76151 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,3047.39,0,0,0,1
|
85
|
+
5.9596 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,3857.95,0,0,0,1 0
|
86
|
+
4.76151 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,3047.39,0,0,0,1 0
|
87
87
|
1.81745 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,1055.59,0,0,0,1 0
|
88
88
|
3.47872 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,2179.52,0,0,0,1 0
|
89
|
-
2.32632 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1399.86,0,0,0,1
|
89
|
+
2.32632 -0.2362347,0.6308649,0.7390552,0,0.6523478,-0.4607318,0.6018043,0,0.7201635,0.6242881,-0.3027024,1399.86,0,0,0,1 0
|
90
90
|
12.4066 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,8219.63,0,0,0,1 0
|
91
91
|
12.4066 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,8219.63,0,0,0,1 0
|
92
|
-
2.32632 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1399.86,0,0,0,1
|
93
|
-
8.19567 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,5370.75,0,0,0,1
|
92
|
+
2.32632 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1399.86,0,0,0,1 0
|
93
|
+
8.19567 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,5370.75,0,0,0,1 0
|
94
94
|
4.11806 0.3832846,0.8818775,-0.2745634,0,0.8566163,-0.4505714,-0.2513841,0,-0.3454004,-0.1388438,-0.9281277,2612.06,0,0,0,1 0
|
95
|
-
2.58728 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1576.42,0,0,0,1
|
96
|
-
5.79983 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,3749.86,0,0,0,1
|
97
|
-
2.57805 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1570.18,0,0,0,1
|
95
|
+
2.58728 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1576.42,0,0,0,1 0
|
96
|
+
5.79983 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,3749.86,0,0,0,1 0
|
97
|
+
2.57805 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,1570.18,0,0,0,1 0
|
98
98
|
13.6304 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,9047.63,0,0,0,1 0
|
99
99
|
3.78516 -0.1539447,-0.2832125,-0.9466212,0,-0.1585857,0.9527035,-0.2592422,0,0.9752699,0.1102116,-0.1915772,2386.84,0,0,0,1 0
|
100
|
-
4.16725 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,2645.34,0,0,0,1
|
100
|
+
4.16725 -0.895577,-0.4178617,0.152753,0,-0.1004795,-0.1445008,-0.9843898,0,0.4334117,-0.8969454,0.08742505,2645.34,0,0,0,1 0
|
data/spec/fixtures/test_xls.xls
CHANGED
Binary file
|
Binary file
|
data/spec/io/io_spec.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
1
2
|
describe Daru::IO do
|
2
3
|
describe Daru::DataFrame do
|
3
4
|
context ".from_csv" do
|
@@ -122,6 +123,38 @@ describe Daru::IO do
|
|
122
123
|
end
|
123
124
|
end
|
124
125
|
|
126
|
+
context "#from_excel with row_id" do
|
127
|
+
before do
|
128
|
+
id = Daru::Vector.new(['id', 1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
|
129
|
+
name = Daru::Vector.new(%w(name Alex Claude Peter Franz George Fernand))
|
130
|
+
age = Daru::Vector.new(['age', 20.0, 23.0, 25.0, nil, 5.5, nil])
|
131
|
+
city = Daru::Vector.new(['city', 'New York', 'London', 'London', 'Paris', 'Tome', nil])
|
132
|
+
a1 = Daru::Vector.new(['a1', 'a,b', 'b,c', 'a', nil, 'a,b,c', nil])
|
133
|
+
@expected_1 = Daru::DataFrame.new({:id2 => id, :name2 => name, :age2 => age}, order: [:id2, :name2, :age2])
|
134
|
+
@expected_2 = Daru::DataFrame.new({
|
135
|
+
:id => id, :name => name, :age => age, :city => city, :a1 => a1
|
136
|
+
}, order: [:id, :name, :age, :city, :a1])
|
137
|
+
end
|
138
|
+
|
139
|
+
it "loads DataFrame from test_xls_2.xls" do
|
140
|
+
df = Daru::DataFrame.from_excel 'spec/fixtures/test_xls_2.xls'
|
141
|
+
|
142
|
+
expect(df.nrows).to eq(7)
|
143
|
+
expect(df.vectors.to_a).to eq([:id2, :name2, :age2])
|
144
|
+
expect(df[:age2][6]).to eq(nil)
|
145
|
+
expect(@expected_1).to eq(df)
|
146
|
+
end
|
147
|
+
|
148
|
+
it "loads DataFrame from test_xls_2.xls with row_id" do
|
149
|
+
df = Daru::DataFrame.from_excel 'spec/fixtures/test_xls_2.xls', {row_id: 1}
|
150
|
+
|
151
|
+
expect(df.nrows).to eq(7)
|
152
|
+
expect(df.vectors.to_a).to eq([:id, :name, :age, :city, :a1])
|
153
|
+
expect(df[:age][6]).to eq(nil)
|
154
|
+
expect(@expected_2).to eq(df)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
125
158
|
context "#write_excel" do
|
126
159
|
before do
|
127
160
|
a = Daru::Vector.new(100.times.map { rand(100) })
|
data/spec/spec_helper.rb
CHANGED
@@ -18,12 +18,6 @@ def jruby?
|
|
18
18
|
RUBY_ENGINE == 'jruby'
|
19
19
|
end
|
20
20
|
|
21
|
-
if jruby?
|
22
|
-
require 'mdarray'
|
23
|
-
else
|
24
|
-
require 'nmatrix/nmatrix'
|
25
|
-
end
|
26
|
-
|
27
21
|
RSpec::Expectations.configuration.warn_about_potential_false_positives = false
|
28
22
|
|
29
23
|
require 'simplecov'
|
@@ -37,6 +31,14 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
37
31
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
38
32
|
require 'daru'
|
39
33
|
|
34
|
+
if jruby?
|
35
|
+
require 'mdarray'
|
36
|
+
else
|
37
|
+
if Daru.has_nmatrix?
|
38
|
+
require 'nmatrix/nmatrix'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
40
42
|
ALL_DTYPES = [:nmatrix, :gsl, :array]
|
41
43
|
|
42
44
|
# FIXME: This must go! Need to be able to use be_within
|
data/spec/vector_spec.rb
CHANGED
@@ -850,6 +850,24 @@ describe Daru::Vector do
|
|
850
850
|
end
|
851
851
|
end
|
852
852
|
|
853
|
+
context '#last' do
|
854
|
+
subject(:vector) do
|
855
|
+
Daru::Vector.new (1..20).to_a, dtype: dtype
|
856
|
+
end
|
857
|
+
|
858
|
+
it 'takes 1 by default' do
|
859
|
+
expect(vector.last).to eq 20
|
860
|
+
end
|
861
|
+
|
862
|
+
it 'takes num if provided' do
|
863
|
+
expect(vector.last(3)).to eq Daru::Vector.new (18..20).to_a, index: (17..19).to_a
|
864
|
+
end
|
865
|
+
|
866
|
+
it 'does not fail on too large num' do
|
867
|
+
expect(vector.last(3000)).to eq vector
|
868
|
+
end
|
869
|
+
end
|
870
|
+
|
853
871
|
context "#concat" do
|
854
872
|
before :each do
|
855
873
|
@dv = Daru::Vector.new [1,2,3,4,5], name: :yoga,
|
@@ -2128,6 +2146,17 @@ describe Daru::Vector do
|
|
2128
2146
|
end
|
2129
2147
|
end
|
2130
2148
|
|
2149
|
+
context '#match' do
|
2150
|
+
subject { dv.match(regexp) }
|
2151
|
+
|
2152
|
+
context 'returns matching array for a given regexp' do
|
2153
|
+
let(:dv) { Daru::Vector.new ['3 days', '5 weeks', '2 weeks'] }
|
2154
|
+
let(:regexp) { /weeks/ }
|
2155
|
+
|
2156
|
+
it { is_expected.to eq([false, true, true]) }
|
2157
|
+
end
|
2158
|
+
end
|
2159
|
+
|
2131
2160
|
context '#method_missing' do
|
2132
2161
|
context 'getting' do
|
2133
2162
|
subject(:vector) { Daru::Vector.new [1,2,3], index: [:a, :b, :c] }
|
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sameer Deshmukh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: backports
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: packable
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
17
|
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.3.
|
19
|
+
version: 1.3.13
|
34
20
|
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
24
|
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.3.
|
26
|
+
version: 1.3.13
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: spreadsheet
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +58,14 @@ dependencies:
|
|
72
58
|
requirements:
|
73
59
|
- - "~>"
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
61
|
+
version: '13.0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
68
|
+
version: '13.0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: pry
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -254,14 +240,14 @@ dependencies:
|
|
254
240
|
requirements:
|
255
241
|
- - "~>"
|
256
242
|
- !ruby/object:Gem::Version
|
257
|
-
version: '
|
243
|
+
version: '6.0'
|
258
244
|
type: :development
|
259
245
|
prerelease: false
|
260
246
|
version_requirements: !ruby/object:Gem::Requirement
|
261
247
|
requirements:
|
262
248
|
- - "~>"
|
263
249
|
- !ruby/object:Gem::Version
|
264
|
-
version: '
|
250
|
+
version: '6.0'
|
265
251
|
- !ruby/object:Gem::Dependency
|
266
252
|
name: mechanize
|
267
253
|
requirement: !ruby/object:Gem::Requirement
|
@@ -280,16 +266,16 @@ dependencies:
|
|
280
266
|
name: sqlite3
|
281
267
|
requirement: !ruby/object:Gem::Requirement
|
282
268
|
requirements:
|
283
|
-
- - "
|
269
|
+
- - ">="
|
284
270
|
- !ruby/object:Gem::Version
|
285
|
-
version:
|
271
|
+
version: '0'
|
286
272
|
type: :development
|
287
273
|
prerelease: false
|
288
274
|
version_requirements: !ruby/object:Gem::Requirement
|
289
275
|
requirements:
|
290
|
-
- - "
|
276
|
+
- - ">="
|
291
277
|
- !ruby/object:Gem::Version
|
292
|
-
version:
|
278
|
+
version: '0'
|
293
279
|
- !ruby/object:Gem::Dependency
|
294
280
|
name: rubocop
|
295
281
|
requirement: !ruby/object:Gem::Requirement
|
@@ -451,6 +437,7 @@ files:
|
|
451
437
|
- lib/daru/accessors/mdarray_wrapper.rb
|
452
438
|
- lib/daru/accessors/nmatrix_wrapper.rb
|
453
439
|
- lib/daru/category.rb
|
440
|
+
- lib/daru/configuration.rb
|
454
441
|
- lib/daru/core/group_by.rb
|
455
442
|
- lib/daru/core/merge.rb
|
456
443
|
- lib/daru/core/query.rb
|
@@ -514,6 +501,7 @@ files:
|
|
514
501
|
- spec/daru_spec.rb
|
515
502
|
- spec/dataframe_spec.rb
|
516
503
|
- spec/date_time/data_spec.rb
|
504
|
+
- spec/date_time/date_time_index_helper_spec.rb
|
517
505
|
- spec/date_time/index_spec.rb
|
518
506
|
- spec/date_time/offsets_spec.rb
|
519
507
|
- spec/extensions/rserve_spec.rb
|
@@ -536,6 +524,7 @@ files:
|
|
536
524
|
- spec/fixtures/string_converter_test.csv
|
537
525
|
- spec/fixtures/strings.dat
|
538
526
|
- spec/fixtures/test_xls.xls
|
527
|
+
- spec/fixtures/test_xls_2.xls
|
539
528
|
- spec/fixtures/url_test.txt~
|
540
529
|
- spec/fixtures/valid_markup.html
|
541
530
|
- spec/fixtures/wiki_climate.html
|
@@ -567,7 +556,7 @@ files:
|
|
567
556
|
- spec/support/database_helper.rb
|
568
557
|
- spec/support/matchers.rb
|
569
558
|
- spec/vector_spec.rb
|
570
|
-
homepage: http://github.com/
|
559
|
+
homepage: http://github.com/SciRuby/daru
|
571
560
|
licenses:
|
572
561
|
- BSD-2
|
573
562
|
metadata: {}
|
@@ -586,7 +575,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
586
575
|
- !ruby/object:Gem::Version
|
587
576
|
version: '0'
|
588
577
|
requirements: []
|
589
|
-
rubygems_version: 3.
|
578
|
+
rubygems_version: 3.1.2
|
590
579
|
signing_key:
|
591
580
|
specification_version: 4
|
592
581
|
summary: Data Analysis in RUby
|
@@ -601,6 +590,7 @@ test_files:
|
|
601
590
|
- spec/daru_spec.rb
|
602
591
|
- spec/dataframe_spec.rb
|
603
592
|
- spec/date_time/data_spec.rb
|
593
|
+
- spec/date_time/date_time_index_helper_spec.rb
|
604
594
|
- spec/date_time/index_spec.rb
|
605
595
|
- spec/date_time/offsets_spec.rb
|
606
596
|
- spec/extensions/rserve_spec.rb
|
@@ -623,6 +613,7 @@ test_files:
|
|
623
613
|
- spec/fixtures/string_converter_test.csv
|
624
614
|
- spec/fixtures/strings.dat
|
625
615
|
- spec/fixtures/test_xls.xls
|
616
|
+
- spec/fixtures/test_xls_2.xls
|
626
617
|
- spec/fixtures/url_test.txt~
|
627
618
|
- spec/fixtures/valid_markup.html
|
628
619
|
- spec/fixtures/wiki_climate.html
|