sycsvpro 0.1.13 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,20 +5,20 @@ module Sycsvpro
5
5
 
6
6
  # Removes copies of rows identified by key values
7
7
  #
8
- # | Name | Street | Town | Country |
9
- # | ---- | ------ | ---- | ------- |
10
- # | Jane | Canal | Win | CA |
11
- # | Jack | Long | Van | CA |
12
- # | Jean | Sing | Ma | DE |
13
- # | Jane | Canal | Win | CA |
8
+ # | Name | Street | Town | Country |
9
+ # | ---- | ------ | ---- | ------- |
10
+ # | Jane | Canal | Win | CA |
11
+ # | Jack | Long | Van | CA |
12
+ # | Jean | Sing | Ma | DE |
13
+ # | Jane | Canal | Win | CA |
14
14
  #
15
15
  # Remove copies based on column 0 (Name)
16
16
  #
17
- # | Name | Street | Town | Country |
18
- # | ---- | ------ | ---- | ------- |
19
- # | Jane | Canal | Win | CA |
20
- # | Jack | Long | Van | CA |
21
- # | Jean | Sing | Ma | DE |
17
+ # | Name | Street | Town | Country |
18
+ # | ---- | ------ | ---- | ------- |
19
+ # | Jane | Canal | Win | CA |
20
+ # | Jack | Long | Van | CA |
21
+ # | Jean | Sing | Ma | DE |
22
22
  class Unique
23
23
 
24
24
  include Dsl
@@ -33,7 +33,6 @@ module Sycsvpro
33
33
  attr_reader :col_filter
34
34
 
35
35
  # Creates a new Unique
36
- # :call-seq:
37
36
  # Sycsvpro::Unique.new(infile: "infile.csv",
38
37
  # outfile: "outfile.csv",
39
38
  # rows: "1,3-4",
@@ -1,5 +1,5 @@
1
1
  # Operating csv files
2
2
  module Sycsvpro
3
3
  # Version number of sycsvpro
4
- VERSION = '0.1.13'
4
+ VERSION = '0.2.0'
5
5
  end
data/lib/sycsvpro.rb CHANGED
@@ -18,3 +18,5 @@ require 'sycsvpro/join.rb'
18
18
  require 'sycsvpro/merger.rb'
19
19
  require 'sycsvpro/unique.rb'
20
20
  require 'sycsvpro/transposer.rb'
21
+ require 'sycsvpro/spread_sheet.rb'
22
+ require 'sycsvpro/spread_sheet_builder.rb'
@@ -0,0 +1,34 @@
1
+ require 'sycsvpro/not_available'
2
+
3
+ module Sycsvpro
4
+
5
+ describe NotAvailable do
6
+
7
+ it "should return na in arithmetic expression like na + 1" do
8
+ na = NotAvailable #NotAvailable.new
9
+
10
+ (na + 1).should eq na
11
+ (na * 2).should eq na
12
+ (na / 3).should eq na
13
+ (na - 4).should eq na
14
+ end
15
+
16
+ it "should return na in arithmetic expression like 1 + na" do
17
+ na = NotAvailable #NotAvailable.new
18
+
19
+ (1 + na).should eq na
20
+ (2 * na).should eq na
21
+ (3 / na).should eq na
22
+ (4 - na).should eq na
23
+ end
24
+
25
+ it "should return na in arbitrary arithmetic expression" do
26
+ na = NotAvailable #NotAvailable.new
27
+
28
+ (na + 1 + 2 * na).should eq na
29
+ (1 + 2 * 3 + na * 4).should eq na
30
+ end
31
+
32
+ end
33
+
34
+ end
@@ -0,0 +1,35 @@
1
+ require 'sycsvpro/spread_sheet_builder'
2
+
3
+ module Sycsvpro
4
+
5
+ describe SpreadSheetBuilder do
6
+
7
+ it "should execute a spread sheet operation" do
8
+ file1 = File.join(File.dirname(__FILE__), "files/spread_sheet1.csv")
9
+ file2 = File.join(File.dirname(__FILE__), "files/spread_sheet2.csv")
10
+ resfile = File.join(File.dirname(__FILE__), "files/spread_sheet_res.csv")
11
+
12
+ operation = "(a*b).transpose"
13
+
14
+ SpreadSheetBuilder.new(outfile: resfile,
15
+ files: [file1,file2].join(','),
16
+ rlabels: "true,false",
17
+ clabels: "true,false",
18
+ aliases: "a,b",
19
+ operation: operation).execute
20
+
21
+ s1 = SpreadSheet.new(['Alpha','Beta','Gamma'],
22
+ ['A',NotAvailable,2,3],
23
+ ['B',4,5,NotAvailable],
24
+ ['C',7,NotAvailable,9], r: true, c: true)
25
+ s2 = SpreadSheet.new([1,2,3],[3,2,1])
26
+ res = SpreadSheet.new(file: resfile, r: true, c: true)
27
+
28
+ res2 = (s1 * s2).transpose
29
+
30
+ expect { (s1 * s2).transpose == res }.to be_true
31
+ end
32
+
33
+ end
34
+
35
+ end
@@ -0,0 +1,415 @@
1
+ require 'sycsvpro/spread_sheet'
2
+
3
+ module Sycsvpro
4
+
5
+ describe SpreadSheet do
6
+
7
+ # Creation of spread sheets
8
+ it "should ensure all rows have the same column size" do
9
+ expect { SpreadSheet.new([1,2], [3,4,5]) }.to raise_error(RuntimeError,
10
+ "rows must be of same column size")
11
+ end
12
+
13
+ it "should not accept non arrays as rows" do
14
+ expect { SpreadSheet.new("abc", "abc") }.to raise_error(RuntimeError,
15
+ "rows need to be arrays")
16
+ end
17
+
18
+ it "should require rows" do
19
+ expect { SpreadSheet.new() }.to raise_error(RuntimeError,
20
+ "needs at least one row")
21
+ end
22
+
23
+ it "should be created from file" do
24
+ file = File.join(File.dirname(__FILE__), "files/spread_sheet.csv")
25
+
26
+ s1 = SpreadSheet.new(file: file, r: true, c: true)
27
+ s2 = SpreadSheet.new(['Alpha', 'Beta', 'Gamma'],
28
+ ['A',1,2,3],['B',4,5,6],['C',7,8,9],
29
+ r: true, c: true)
30
+ expect { s1 == s2 }
31
+ end
32
+
33
+ it "should be created from file with missing values" do
34
+ file = File.join(File.dirname(__FILE__), "files/spread_sheet_na.csv")
35
+
36
+ s1 = SpreadSheet.new(file: file, r: true, c: true)
37
+ s2 = SpreadSheet.new(['Alpha', 'Beta', 'Gamma'],
38
+ ['A',NotAvailable,2,3],
39
+ ['B',4,5,NotAvailable],
40
+ ['C',7,NotAvailable,9],
41
+ r: true, c: true)
42
+ expect { s1 == s2 }
43
+ end
44
+
45
+ it "should be created from flat array" do
46
+ s1 = SpreadSheet.new(values: [1,2,3,4,5,6], cols: 2)
47
+ s2 = SpreadSheet.new([1,2],[3,4],[5,6])
48
+ s1.should eq s2
49
+ s1 = SpreadSheet.new(values: [1,2,3,4,5,6], rows: 2)
50
+ s2 = SpreadSheet.new([1,2,3],[4,5,6])
51
+ s1.should eq s2
52
+ s1 = SpreadSheet.new(values: [1,2,3,4,5,6], rows: 3, cols: 2)
53
+ s2 = SpreadSheet.new([1,2],[3,4],[5,6])
54
+ s1.should eq s2
55
+ s1 = SpreadSheet.new(values: [1,2,3,4,5], rows: 2)
56
+ s2 = SpreadSheet.new([1,2,3],[4,5,NotAvailable])
57
+ s1.should eq s2
58
+ s1 = SpreadSheet.new(values: [1,2,3,4,5], cols: 3)
59
+ s2 = SpreadSheet.new([1,2,3],[4,5,NotAvailable])
60
+ s1.should eq s2
61
+ end
62
+
63
+ # Writing of spread sheets
64
+
65
+ it "should write to file" do
66
+ file = File.join(File.dirname(__FILE__), "files/spread_sheet_out.csv")
67
+
68
+ s1 = SpreadSheet.new(['A', 'B', 'C'],['I',1,2,3],['II',4,5,6],
69
+ r: true, c: true)
70
+ s1.write(file)
71
+ Dir.glob(file).size.should eq 1
72
+ end
73
+
74
+ # Manipulating spread sheets
75
+
76
+ it "should transpose rows and columns" do
77
+ s1 = SpreadSheet.new(["C1","C2","C3"],['A',1,3,5],['B',7,11,13], r: true, c: true)
78
+ s2 = SpreadSheet.new(['A','B'],['C1',1,7],['C2',3,11],['C3',5,13], r: true, c: true)
79
+ expect { s1.tranpose == s2 }
80
+ end
81
+
82
+ it "should assign new values to rows and columns"
83
+
84
+ it "should delete columns"
85
+
86
+ it "should delete rows"
87
+
88
+ # Information about spread sheets
89
+
90
+ it "should return the dimension of a spreadsheet" do
91
+ s1 = SpreadSheet.new([1,2,3], [3,4,5])
92
+ s1.dim.should eq [2,3]
93
+ end
94
+
95
+ it "should return the row count" do
96
+ s1 = SpreadSheet.new([1,2,3], [4,5,6], [7,8,9])
97
+ s1.nrows.should eq 3
98
+ end
99
+
100
+ it "should return the column count" do
101
+ s1 = SpreadSheet.new([1,2,3], [4,5,6], [7,8,9])
102
+ s1.ncols.should eq 3
103
+ end
104
+
105
+ it "should return the size" do
106
+ s1 = SpreadSheet.new([1,2,3], [4,5,6], [7,8,9])
107
+ s1.size.should eq 9
108
+ end
109
+
110
+ it "should return default row and column labels" do
111
+ s1 = SpreadSheet.new([1,2,3], [4,5,6], [7,8,9])
112
+ s1.row_labels.should eq [0,1,2]
113
+ s1.col_labels.should eq [0,1,2]
114
+ end
115
+
116
+ it "should check whether two spread sheets are equal" do
117
+ s1 = SpreadSheet.new([1,2,3], [4,5,6])
118
+ (s1 == s1).should be_true
119
+ s2 = SpreadSheet.new([3,2,1], [6,5,4])
120
+ (s1 == s2).should be_false
121
+ end
122
+
123
+ # Subsetting spread sheets
124
+
125
+ it "should retrieve rows based on row number" do
126
+ s1 = SpreadSheet.new([1,2,3], [4,5,6])
127
+ s2 = SpreadSheet.new([4,5,6])
128
+ s1[1,].should eq s2
129
+ s1[nil,nil].should eq s1
130
+ end
131
+
132
+ it "should return columns based on column numbers" do
133
+ s1 = SpreadSheet.new([1,2,3], [4,5,6])
134
+ s2 = SpreadSheet.new([3],[6])
135
+ s1[nil,2].should eq s2
136
+ end
137
+
138
+ it "should return a subset of the table" do
139
+ s1 = SpreadSheet.new([1,2,3], [4,5,6])
140
+ s2 = SpreadSheet.new([5,6])
141
+ s1[1,1..2].should eq s2
142
+ s1 = SpreadSheet.new([10,11,12], [13,14,15])
143
+ s2 = SpreadSheet.new([11,12], [14,15])
144
+ s1[nil,1..2].should eq s2
145
+ s1 = SpreadSheet.new([16,17,18], [19,20,21])
146
+ s2 = SpreadSheet.new([16,18], [19,21])
147
+ s1[nil,[0,2]].should eq s2
148
+ end
149
+
150
+ it "should bind two spread sheets column wise" do
151
+ s1 = SpreadSheet.new([10,11,12], [13,14,15])
152
+ s2 = SpreadSheet.new([16,17,18], [19,20,21])
153
+
154
+ s3 = SpreadSheet.bind_columns(s1,s2)
155
+ result = SpreadSheet.new([10,11,12,16,17,18],[13,14,15,19,20,21])
156
+
157
+ expect { s3 == result }
158
+ end
159
+
160
+ it "should bind two spread sheets with different row size column wise" do
161
+ s1 = SpreadSheet.new([10,11,12], [13,14,15], [16,17,18])
162
+ s2 = SpreadSheet.new([16,17,18], [19,20,21])
163
+
164
+ s3 = SpreadSheet.bind_columns(s1,s2)
165
+ result = SpreadSheet.new([10,11,12,16,17,18],[13,14,15,19,20,21],
166
+ [16,17,18,
167
+ NotAvailable,NotAvailable,NotAvailable])
168
+
169
+ expect { s3 == result }.to be_true
170
+ s3.should eq result
171
+ end
172
+
173
+ it "should bind two spread sheets row wise" do
174
+ s1 = SpreadSheet.new([10,11,12], [13,14,15])
175
+ s2 = SpreadSheet.new([16,17,18], [19,20,21])
176
+
177
+ s3 = SpreadSheet.bind_rows(s1,s2)
178
+ result = SpreadSheet.new([10,11,12],[13,14,15],[16,17,18],[19,20,21])
179
+
180
+ expect { s3 == result }.to be_true
181
+ s3.should eq result
182
+ end
183
+
184
+ it "should bind two spread sheets row wise with different column size" do
185
+ s1 = SpreadSheet.new([10,11,12], [13,14,15])
186
+ s2 = SpreadSheet.new([16,17], [19,20])
187
+
188
+ s3 = SpreadSheet.bind_rows(s1,s2)
189
+ result = SpreadSheet.new([10,11,12],[13,14,15],
190
+ [16,17,NotAvailable],[19,20,NotAvailable])
191
+
192
+ expect { s3 == result }.to be_true
193
+ s3.should eq result
194
+ end
195
+
196
+ # Calculating with spread sheets
197
+
198
+ it "should multiply two spread sheets of same size" do
199
+ v1 = SpreadSheet.new([1,2],[3,4])
200
+ v2 = SpreadSheet.new([5,6],[7,8])
201
+ v3 = SpreadSheet.new([5,12],[21,32])
202
+ (v1 * v2).should eq v3
203
+ end
204
+
205
+ it "should multiply two spread sheets of different size" do
206
+ v1 = SpreadSheet.new([2],[4])
207
+ v2 = SpreadSheet.new([5,6],[7,8])
208
+ v3 = SpreadSheet.new([10,12],[28,32])
209
+ (v1 * v2).should eq v3
210
+ (v2 * v1).should eq v3
211
+
212
+ v1 = SpreadSheet.new([2,3,4],[4,5,6])
213
+ v2 = SpreadSheet.new([5,6],[7,8])
214
+ v3 = SpreadSheet.new([10,18,20],[28,40,42])
215
+ (v1 * v2).should eq v3
216
+ (v2 * v1).should eq v3
217
+ end
218
+
219
+ it "should add two spread sheets" do
220
+ v1 = SpreadSheet.new([1,2],[3,4])
221
+ v2 = SpreadSheet.new([5,6],[7,8])
222
+ v3 = SpreadSheet.new([6,8],[10,12])
223
+ (v1 + v2).should eq v3
224
+ end
225
+
226
+ it "should subtract two spread sheets" do
227
+ v1 = SpreadSheet.new([1,2],[3,4])
228
+ v2 = SpreadSheet.new([5,6],[7,8])
229
+ v3 = SpreadSheet.new([-4,-4],[-4,-4])
230
+ (v1 - v2).should eq v3
231
+ end
232
+
233
+ it "should devide two spread sheets" do
234
+ v1 = SpreadSheet.new([1,2],[3,4])
235
+ v2 = SpreadSheet.new([5,6],[7,8])
236
+ v3 = SpreadSheet.new([1/5,2/6],[3/7,4/8])
237
+ (v1 / v2).should eq v3
238
+ end
239
+
240
+ it "should work with numericals" do
241
+ v1 = SpreadSheet.new([1,2],[3,4])
242
+ v2 = SpreadSheet.new([2,4],[6,8])
243
+ (v1 * 2).should eq v2
244
+ end
245
+
246
+ it "should work with arrays" do
247
+ v1 = SpreadSheet.new([1,2],[3,4])
248
+ v2 = SpreadSheet.new([3,6],[9,8])
249
+ expect { v1 * [3,2] == v2 }.to be_true
250
+ end
251
+
252
+ it "should multiply each column with all columns of a spread sheet" do
253
+ v1 = SpreadSheet.new([1,2],[3,4])
254
+ v2 = SpreadSheet.new([5,6],[7,8])
255
+
256
+ result = []
257
+ v1.each_column { |c| result << c*v2 }
258
+
259
+ # 1 2 5 6 5 6 10 12
260
+ # 3 4 7 8 21 24 28 32
261
+
262
+ v3 = SpreadSheet.new([5,6],[21,24])
263
+ v4 = SpreadSheet.new([10,12],[28,32])
264
+ result.should eq [v3,v4]
265
+ end
266
+
267
+ it "should collect the result of all multiplications" do
268
+ v1 = SpreadSheet.new([1,2],[3,4])
269
+ v2 = SpreadSheet.new([5,6],[7,8])
270
+
271
+ result = v1.column_collect { |c| c * v2 }
272
+
273
+ v3 = SpreadSheet.new([5,6],[21,24])
274
+ v4 = SpreadSheet.new([10,12],[28,32])
275
+
276
+ result.should eq [v3,v4]
277
+ end
278
+
279
+ # Spread sheets with column and row labels
280
+
281
+ it "should create spread sheet with row labels" do
282
+ v1 = SpreadSheet.new([1,2],[3,4], row_labels: ['A','B'])
283
+ v1.opts[:r].should be_true
284
+ v1.opts[:c].should be_false
285
+ v1.row_labels.should eq ['A','B']
286
+ v1.col_labels.should eq [0,1]
287
+ end
288
+
289
+ it "should create spread sheet with column labels" do
290
+ v1 = SpreadSheet.new([1,2],[3,4], col_labels: ['X','Y'])
291
+ v1.opts[:r].should be_false
292
+ v1.opts[:c].should be_true
293
+ v1.row_labels.should eq [0,1]
294
+ v1.col_labels.should eq ['X','Y']
295
+ end
296
+
297
+ it "should create spread sheet with row and column labels" do
298
+ v1 = SpreadSheet.new([1,2],[3,4], row_labels: ['A','B'],
299
+ col_labels: ['X','Y'])
300
+ v1.opts[:r].should be_true
301
+ v1.opts[:c].should be_true
302
+ v1.row_labels.should eq ['A','B']
303
+ v1.col_labels.should eq ['X','Y']
304
+ end
305
+
306
+ it "should create spread sheet with uncomplete row and column labels" do
307
+ v1 = SpreadSheet.new([1,2,3],[3,4,5],[6,7,8], row_labels: ['A','B'],
308
+ col_labels: ['X','Y'])
309
+ v1.opts[:r].should be_true
310
+ v1.opts[:c].should be_true
311
+ v1.row_labels.should eq ['A','B',2]
312
+ v1.col_labels.should eq ['X','Y',2]
313
+ end
314
+
315
+ it "should return provided row labels" do
316
+ v1 = SpreadSheet.new(['A',1,2],['B',3,4], r: true)
317
+ v1.opts[:r].should be_true
318
+ v1.opts[:c].should be_false
319
+ v1.row_labels.should eq ['A','B']
320
+ v1.col_labels.should eq [0,1]
321
+ end
322
+
323
+ it "should return provided column labels" do
324
+ v1 = SpreadSheet.new(['X','Y'],[1,2],[3,4], c: true)
325
+ v1.opts[:r].should be_false
326
+ v1.opts[:c].should be_true
327
+ v1.row_labels.should eq [0,1]
328
+ v1.col_labels.should eq ['X','Y']
329
+ end
330
+
331
+ it "should return provided row and column labels" do
332
+ v1 = SpreadSheet.new(['X','Y'], ['A',1,2],['B',3,4], r: true, c: true)
333
+ v1.opts[:r].should be_true
334
+ v1.opts[:c].should be_true
335
+ v1.row_labels.should eq ['A','B']
336
+ v1.col_labels.should eq ['X','Y']
337
+ end
338
+
339
+ it "should fill missing labels with default labels" do
340
+ v1 = SpreadSheet.new(['X','Y'], ['A',1,2,3],['B',3,4,5], r: true, c: true)
341
+ v1.opts[:r].should be_true
342
+ v1.opts[:c].should be_true
343
+ v1.row_labels.should eq ['A','B']
344
+ v1.col_labels.should eq ['X','Y',2]
345
+ end
346
+
347
+ it "should return provided row and column labels with row column label" do
348
+ v1 = SpreadSheet.new(['Letter','X','Y'], ['A',1,2],['B',3,4], r: true, c: true)
349
+ v1.opts[:r].should be_true
350
+ v1.opts[:c].should be_true
351
+ v1.row_labels.should eq ['A','B']
352
+ v1.col_labels.should eq ['X','Y']
353
+ end
354
+
355
+ it "should rename row and column labels with same label count" do
356
+ s1 = SpreadSheet.new([1,2,3,4],[5,6,7,8])
357
+ s1.row_labels.should eq [0,1]
358
+ s1.col_labels.should eq [0,1,2,3]
359
+
360
+ s1.rename(rows: ['A','B'], cols: ['X','Ypsilon','Z','X1'])
361
+ s1.row_labels.should eq ['A','B']
362
+ s1.col_labels.should eq ['X','Ypsilon','Z','X1']
363
+ end
364
+
365
+ it "should rename row and column labels with different label count" do
366
+ s1 = SpreadSheet.new([1,2,3,4],[5,6,7,8])
367
+ s1.row_labels.should eq [0,1]
368
+ s1.col_labels.should eq [0,1,2,3]
369
+
370
+ s1.rename(rows: ['A'], cols: ['X','Ypsilon','Z'])
371
+ s1.row_labels.should eq ['A',1]
372
+ s1.col_labels.should eq ['X','Ypsilon','Z',3]
373
+ end
374
+
375
+ it "should create subset with row and column labels" do
376
+ v1 = SpreadSheet.new(['Letter','X','Y'], ['A',1,2],['B',3,4], r: true, c: true)
377
+ v2 = v1[nil, 1]
378
+ v2.row_labels.should eq ['A', 'B']
379
+ v2.col_labels.should eq ['Y']
380
+ end
381
+
382
+ it "should multiply spread sheets with row labels" do
383
+ v1 = SpreadSheet.new(['A', 1,2],['B', 3,4], r: true)
384
+ v2 = SpreadSheet.new([5,6],[7,8])
385
+ v3 = SpreadSheet.new([5, 12], [21, 32])
386
+ v4 = v1 * v2
387
+ v4.should eq v3
388
+ v4.row_labels.should eq ['A*0', 'B*1']
389
+ v4.col_labels.should eq ['0*0','1*1']
390
+ end
391
+
392
+ it "should multiply spread sheets with column labels" do
393
+ v1 = SpreadSheet.new(['X','Y'],[1,2],[3,4], c: true)
394
+ v2 = SpreadSheet.new([5,6],[7,8])
395
+ v3 = SpreadSheet.new([5, 12], [21, 32])
396
+ v4 = v1 * v2
397
+ v4.should eq v3
398
+ v4.row_labels.should eq ['0*0','1*1']
399
+ v4.col_labels.should eq ['X*0','Y*1']
400
+ end
401
+
402
+ it "should multiply spread sheets with row and column labels" do
403
+ v1 = SpreadSheet.new(['X','Y'],['A', 1,2],['B', 3,4], r: true, c: true)
404
+ v2 = SpreadSheet.new([5,6],[7,8])
405
+ v3 = SpreadSheet.new([5, 12], [21, 32])
406
+ v4 = v1 * v2
407
+ v4.should eq v3
408
+ v4.row_labels.should eq ['A*0', 'B*1']
409
+ v4.col_labels.should eq ['X*0', 'Y*1']
410
+ end
411
+
412
+ end
413
+
414
+ end
415
+
data/sycsvpro.rdoc CHANGED
@@ -1,5 +1,3 @@
1
- = sycsvpro
2
-
3
1
  NAME
4
2
  sycsvpro - Processing CSV files
5
3
 
@@ -7,7 +5,7 @@ SYNOPSIS
7
5
  sycsvpro [global options] command [command options] [arguments...]
8
6
 
9
7
  VERSION
10
- 0.1.7
8
+ 0.2.0
11
9
 
12
10
  GLOBAL OPTIONS
13
11
  -f, --file=FILE - CSV file to operate on (default: none)
@@ -17,24 +15,27 @@ GLOBAL OPTIONS
17
15
  --version - Display the program version
18
16
 
19
17
  COMMANDS
20
- aggregate - Aggregates the occurences of row values. Optionally adds a sum row
21
- allocate - Allocate specified columns from the file to a key value
22
- analyze - Analyze the CSV file regarding columns, rows and content
23
- calc - Process operations on columns. Optionally add a sum row for columns withnumber
24
- values
25
- collect - Collect values of specified rows and columns from the file and group them in
26
- categories
27
- count - Counts the occurences of column values. Uses column values as headings with count as
28
- values. Columns with a condition will be added as new columns and the condition will
29
- be set as column name. Optionally adds a sum row
30
- edit - Creates a script/insert file or opens a script/insert file for editing if it exists
31
- execute - Executes the code provided in a file
32
- extract - Extract specified rows and columns from the file
33
- help - Shows a list of commands or help for one command
34
- insert - Inserts rows from a file to a csv-file
35
- join - Join two files based on a joint column value
36
- list - Lists script or insert files in the scripts directory with optionally listing
37
- methods of script files
38
- map - Map values in columns to new values
39
- sort - Sort rows based on column values
40
- table - Creates a table from a source file
18
+ aggregate - Aggregates the occurences of row values. Optionally adds a sum row
19
+ allocate - Allocate specified columns from the file to a key value
20
+ analyze - Analyze the CSV file regarding columns, rows and content
21
+ calc - Process operations on columns. Optionally add a sum row for columns withnumber values
22
+ collect - Collect values of specified rows and columns from the file and group them in categories
23
+ count - Counts the occurences of column values. Uses column values as headings with count as values. Columns with a condition will be added as new columns
24
+ and the condition will be set as column name. Optionally adds a sum row
25
+ edit - Creates a script/insert file or opens a script/insert file for editing if it exists
26
+ execute - Executes the code provided in a file
27
+ extract - Extract specified rows and columns from the file
28
+ help - Shows a list of commands or help for one command
29
+ insert - Inserts rows from a file to a csv-file. You can for instance add sum operations in Excel or LibreOffice style if you want to process the resulting
30
+ file in Excel or LibreOffice
31
+ join - Join two files based on a joint column value
32
+ list - Lists script or insert files in the scripts directory with optionally listing methods of script files
33
+ map - Map values in columns to new values
34
+ merge - Merge multiple files based on a common column value with a key value at the first column of a row
35
+ sort - Sort rows based on column values. It is possible to sort on multiple columns
36
+ spreadsheet - Do arithmetic operation with table like data. The table has to have rows with same size. Arithmetic operations are *, /, + and - where the results
37
+ can be concatenated. Complete functions can be looked up at https://rubygems.org/gem/sycsvpro
38
+ table - Associates columns to a key value. A key value can be a combination of multiple column values. Values associated can be generated from an arithmetic
39
+ or string operation. Header columns can be generated dynamically based on column values
40
+ transpose - Transposes rows and columns
41
+ unique - Remove duplicate rows from a file. Duplicates are identified by key columns
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sycsvpro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-14 00:00:00.000000000 Z
12
+ date: 2014-10-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -145,11 +145,14 @@ files:
145
145
  - lib/sycsvpro/join.rb
146
146
  - lib/sycsvpro/mapper.rb
147
147
  - lib/sycsvpro/merger.rb
148
+ - lib/sycsvpro/not_available.rb
148
149
  - lib/sycsvpro/profiler.rb
149
150
  - lib/sycsvpro/row_filter.rb
150
151
  - lib/sycsvpro/script_creator.rb
151
152
  - lib/sycsvpro/script_list.rb
152
153
  - lib/sycsvpro/sorter.rb
154
+ - lib/sycsvpro/spread_sheet.rb
155
+ - lib/sycsvpro/spread_sheet_builder.rb
153
156
  - lib/sycsvpro/table.rb
154
157
  - lib/sycsvpro/transposer.rb
155
158
  - lib/sycsvpro/unique.rb
@@ -171,10 +174,13 @@ files:
171
174
  - spec/sycsvpro/join_spec.rb
172
175
  - spec/sycsvpro/mapper_spec.rb
173
176
  - spec/sycsvpro/merger_spec.rb
177
+ - spec/sycsvpro/not_available_spec.rb
174
178
  - spec/sycsvpro/profiler_spec.rb
175
179
  - spec/sycsvpro/row_filter_spec.rb
176
180
  - spec/sycsvpro/script_list_spec.rb
177
181
  - spec/sycsvpro/sorter_spec.rb
182
+ - spec/sycsvpro/spread_sheet_builder_spec.rb
183
+ - spec/sycsvpro/spread_sheet_spec.rb
178
184
  - spec/sycsvpro/table_spec.rb
179
185
  - spec/sycsvpro/transposer_spec.rb
180
186
  - spec/sycsvpro/unique_spec.rb