charty 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/charty.gemspec +8 -5
- data/lib/charty.rb +2 -2
- data/lib/charty/backends/plotly.rb +197 -8
- data/lib/charty/backends/pyplot.rb +135 -44
- data/lib/charty/dash_pattern_generator.rb +57 -0
- data/lib/charty/index.rb +1 -1
- data/lib/charty/plot_methods.rb +73 -3
- data/lib/charty/plotters.rb +1 -0
- data/lib/charty/plotters/abstract_plotter.rb +69 -9
- data/lib/charty/plotters/line_plotter.rb +300 -0
- data/lib/charty/plotters/relational_plotter.rb +213 -96
- data/lib/charty/plotters/scatter_plotter.rb +7 -31
- data/lib/charty/statistics.rb +2 -2
- data/lib/charty/table.rb +124 -14
- data/lib/charty/table_adapters/base_adapter.rb +97 -0
- data/lib/charty/table_adapters/daru_adapter.rb +2 -0
- data/lib/charty/table_adapters/datasets_adapter.rb +7 -0
- data/lib/charty/table_adapters/hash_adapter.rb +13 -2
- data/lib/charty/table_adapters/pandas_adapter.rb +82 -0
- data/lib/charty/util.rb +8 -0
- data/lib/charty/vector_adapters.rb +5 -1
- data/lib/charty/vector_adapters/array_adapter.rb +2 -10
- data/lib/charty/vector_adapters/daru_adapter.rb +3 -11
- data/lib/charty/vector_adapters/narray_adapter.rb +1 -6
- data/lib/charty/vector_adapters/numpy_adapter.rb +1 -1
- data/lib/charty/vector_adapters/pandas_adapter.rb +0 -1
- data/lib/charty/version.rb +1 -1
- metadata +54 -25
- data/lib/charty/missing_value_support.rb +0 -14
data/lib/charty/util.rb
CHANGED
@@ -22,7 +22,6 @@ module Charty
|
|
22
22
|
class BaseAdapter
|
23
23
|
extend Forwardable
|
24
24
|
include Enumerable
|
25
|
-
include MissingValueSupport
|
26
25
|
|
27
26
|
def self.adapter_name
|
28
27
|
name[/:?(\w+)Adapter\z/, 1]
|
@@ -61,6 +60,11 @@ module Charty
|
|
61
60
|
def_delegators :data, :[], :[]=
|
62
61
|
def_delegators :data, :each, :to_a, :empty?
|
63
62
|
|
63
|
+
# Take values at the given positional indices (without indexing)
|
64
|
+
def values_at(*indices)
|
65
|
+
indices.map {|i| data[i] }
|
66
|
+
end
|
67
|
+
|
64
68
|
def where_in_array(mask)
|
65
69
|
mask = check_mask_vector(mask)
|
66
70
|
masked_data = []
|
@@ -30,7 +30,6 @@ module Charty
|
|
30
30
|
include NameSupport
|
31
31
|
include IndexSupport
|
32
32
|
|
33
|
-
# TODO: Reconsider the return value type of values_at
|
34
33
|
def_delegators :data, :values_at
|
35
34
|
|
36
35
|
def where(mask)
|
@@ -80,14 +79,7 @@ module Charty
|
|
80
79
|
|
81
80
|
def drop_na
|
82
81
|
if numeric?
|
83
|
-
Charty::Vector.new(data.reject { |x|
|
84
|
-
case x
|
85
|
-
when Float
|
86
|
-
x.nan?
|
87
|
-
else
|
88
|
-
x.nil?
|
89
|
-
end
|
90
|
-
})
|
82
|
+
Charty::Vector.new(data.reject { |x| Util.missing?(x) })
|
91
83
|
else
|
92
84
|
Charty::Vector.new(data.compact)
|
93
85
|
end
|
@@ -100,7 +92,7 @@ module Charty
|
|
100
92
|
end
|
101
93
|
|
102
94
|
def notnull
|
103
|
-
Charty::Vector.new(data.map {|x| !
|
95
|
+
Charty::Vector.new(data.map {|x| ! Util.missing?(x) },
|
104
96
|
index: index,
|
105
97
|
name: name)
|
106
98
|
end
|
@@ -55,7 +55,7 @@ module Charty
|
|
55
55
|
def_delegators :data, :[]=, :to_a
|
56
56
|
|
57
57
|
def values_at(*indices)
|
58
|
-
indices.map {|i| data
|
58
|
+
indices.map {|i| data.at(i) }
|
59
59
|
end
|
60
60
|
|
61
61
|
def where(mask)
|
@@ -130,15 +130,7 @@ module Charty
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def drop_na
|
133
|
-
values = data.reject
|
134
|
-
case
|
135
|
-
when x.nil?,
|
136
|
-
x.respond_to?(:nan?) && x.nan?
|
137
|
-
true
|
138
|
-
else
|
139
|
-
false
|
140
|
-
end
|
141
|
-
end
|
133
|
+
values = data.reject {|x| Util.missing?(x) }
|
142
134
|
Charty::Vector.new(Daru::Vector.new(values))
|
143
135
|
end
|
144
136
|
|
@@ -149,7 +141,7 @@ module Charty
|
|
149
141
|
end
|
150
142
|
|
151
143
|
def notnull
|
152
|
-
notnull_data = data.map {|x| !
|
144
|
+
notnull_data = data.map {|x| ! Util.missing?(x) }
|
153
145
|
Charty::Vector.new(notnull_data, index: data.index.to_a, name: name)
|
154
146
|
end
|
155
147
|
|
@@ -29,11 +29,6 @@ module Charty
|
|
29
29
|
include NameSupport
|
30
30
|
include IndexSupport
|
31
31
|
|
32
|
-
# TODO: Reconsider the return value type of values_at
|
33
|
-
def values_at(*indices)
|
34
|
-
data[indices].to_a
|
35
|
-
end
|
36
|
-
|
37
32
|
def where(mask)
|
38
33
|
mask = check_mask_vector(mask)
|
39
34
|
case mask.data
|
@@ -157,7 +152,7 @@ module Charty
|
|
157
152
|
i, n = 0, length
|
158
153
|
notnull_data = Numo::Bit.zeros(n)
|
159
154
|
while i < n
|
160
|
-
notnull_data[i] = !
|
155
|
+
notnull_data[i] = ! Util.missing?(data[i])
|
161
156
|
i += 1
|
162
157
|
end
|
163
158
|
when ->(x) { x.respond_to?(:isnan) }
|
data/lib/charty/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: charty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youchan
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-06-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: red-colors
|
@@ -18,28 +18,70 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 0.3.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
28
|
+
version: 0.3.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: red-palette
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.5.0
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.5.0
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: matplotlib
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.2.0
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.2.0
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: pandas
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 0.3.5
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 0.3.5
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: playwright-ruby-client
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
36
78
|
type: :runtime
|
37
79
|
prerelease: false
|
38
80
|
version_requirements: !ruby/object:Gem::Requirement
|
39
81
|
requirements:
|
40
82
|
- - ">="
|
41
83
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0
|
84
|
+
version: '0'
|
43
85
|
- !ruby/object:Gem::Dependency
|
44
86
|
name: bundler
|
45
87
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,14 +130,14 @@ dependencies:
|
|
88
130
|
requirements:
|
89
131
|
- - ">="
|
90
132
|
- !ruby/object:Gem::Version
|
91
|
-
version: 0.
|
133
|
+
version: 0.1.2
|
92
134
|
type: :development
|
93
135
|
prerelease: false
|
94
136
|
version_requirements: !ruby/object:Gem::Requirement
|
95
137
|
requirements:
|
96
138
|
- - ">="
|
97
139
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.
|
140
|
+
version: 0.1.2
|
99
141
|
- !ruby/object:Gem::Dependency
|
100
142
|
name: daru
|
101
143
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,34 +194,20 @@ dependencies:
|
|
152
194
|
- - ">="
|
153
195
|
- !ruby/object:Gem::Version
|
154
196
|
version: '0'
|
155
|
-
- !ruby/object:Gem::Dependency
|
156
|
-
name: playwright-ruby-client
|
157
|
-
requirement: !ruby/object:Gem::Requirement
|
158
|
-
requirements:
|
159
|
-
- - ">="
|
160
|
-
- !ruby/object:Gem::Version
|
161
|
-
version: '0'
|
162
|
-
type: :development
|
163
|
-
prerelease: false
|
164
|
-
version_requirements: !ruby/object:Gem::Requirement
|
165
|
-
requirements:
|
166
|
-
- - ">="
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
version: '0'
|
169
197
|
- !ruby/object:Gem::Dependency
|
170
198
|
name: iruby
|
171
199
|
requirement: !ruby/object:Gem::Requirement
|
172
200
|
requirements:
|
173
201
|
- - ">="
|
174
202
|
- !ruby/object:Gem::Version
|
175
|
-
version:
|
203
|
+
version: 0.7.0
|
176
204
|
type: :development
|
177
205
|
prerelease: false
|
178
206
|
version_requirements: !ruby/object:Gem::Requirement
|
179
207
|
requirements:
|
180
208
|
- - ">="
|
181
209
|
- !ruby/object:Gem::Version
|
182
|
-
version:
|
210
|
+
version: 0.7.0
|
183
211
|
description: Visualizing your data in a simple way.
|
184
212
|
email:
|
185
213
|
- youchan01@gmail.com
|
@@ -262,10 +290,10 @@ files:
|
|
262
290
|
- lib/charty/backends/pyplot.rb
|
263
291
|
- lib/charty/backends/rubyplot.rb
|
264
292
|
- lib/charty/backends/unicode_plot.rb
|
293
|
+
- lib/charty/dash_pattern_generator.rb
|
265
294
|
- lib/charty/index.rb
|
266
295
|
- lib/charty/layout.rb
|
267
296
|
- lib/charty/linspace.rb
|
268
|
-
- lib/charty/missing_value_support.rb
|
269
297
|
- lib/charty/plot_methods.rb
|
270
298
|
- lib/charty/plotter.rb
|
271
299
|
- lib/charty/plotters.rb
|
@@ -275,6 +303,7 @@ files:
|
|
275
303
|
- lib/charty/plotters/categorical_plotter.rb
|
276
304
|
- lib/charty/plotters/count_plotter.rb
|
277
305
|
- lib/charty/plotters/estimation_support.rb
|
306
|
+
- lib/charty/plotters/line_plotter.rb
|
278
307
|
- lib/charty/plotters/random_support.rb
|
279
308
|
- lib/charty/plotters/relational_plotter.rb
|
280
309
|
- lib/charty/plotters/scatter_plotter.rb
|