Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
3
Task/CSV-data-manipulation/J/csv-data-manipulation-1.j
Normal file
3
Task/CSV-data-manipulation/J/csv-data-manipulation-1.j
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
data=: (','&splitstring);.2 freads 'rc_csv.csv' NB. read and parse data
|
||||
data=: (<'"spam"') (<2 3)} data NB. amend cell in 3rd row, 4th column (0-indexing)
|
||||
'rc_outcsv.csv' fwrites~ ;<@(','&joinstring"1) data NB. format and write out amended data
|
||||
4
Task/CSV-data-manipulation/J/csv-data-manipulation-2.j
Normal file
4
Task/CSV-data-manipulation/J/csv-data-manipulation-2.j
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require 'tables/csv'
|
||||
data=: makenum readcsv 'rc_csv.csv' NB. read data and convert cells to numeric where possible
|
||||
data=: (<'spam') (2 3;3 0)} data NB. amend 2 cells
|
||||
data writecsv 'rc_outcsv.csv' NB. write out amended data. Strings are double-quoted
|
||||
5
Task/CSV-data-manipulation/J/csv-data-manipulation-3.j
Normal file
5
Task/CSV-data-manipulation/J/csv-data-manipulation-3.j
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
require 'tables/csv'
|
||||
'hdr data'=: split readcsv 'rc_csv.csv' NB. read data, split the header & data
|
||||
hdr=: hdr , <'SUM' NB. add title for extra column to header
|
||||
data=: <"0 (,. +/"1) makenum data NB. convert to numeric, sum rows & append column
|
||||
(hdr,data) writecsv 'rc_out.csv'
|
||||
2
Task/CSV-data-manipulation/J/csv-data-manipulation-4.j
Normal file
2
Task/CSV-data-manipulation/J/csv-data-manipulation-4.j
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
sumCSVrows=: writecsv~ (((<'SUM') ,~ {.) , [: (<"0)@(,. +/"1) makenum@}.)@readcsv
|
||||
'rc_out.csv' sumCSVrows 'rc.csv'
|
||||
Loading…
Add table
Add a link
Reference in a new issue