File tree 2 files changed +40
-9
lines changed
2 files changed +40
-9
lines changed Original file line number Diff line number Diff line change 1
1
# CSV to Matrix
2
2
3
- CVS to Matrix parser. Reads a CSV file, outputs a arrays in array (Matrix): ` npm install csv-to-matrix `
3
+ A simple CVS to Matrix parser - reads a CSV file, outputs an arrays in array (Matrix).
4
+
5
+ ## Installation
6
+
7
+ ` npm install csv-to-array-matrix `
8
+
9
+ ## Usage
10
+
11
+
12
+ ```
13
+ import csvToMatrix from 'csv-to-array-matrix';
14
+
15
+ csvToMatrix('./src/data.csv', callback);
16
+
17
+ function callback(data) {
18
+ console.log(data);
19
+ }
20
+ ```
21
+
22
+ Transforming into a [ Matrix object with math.js] ( https://www.robinwieruch.de/linear-algebra-matrix-javascript/ ) .
4
23
5
24
```
6
25
import math from 'mathjs';
7
- import csvToMatrix from 'csv-to-matrix';
26
+ import csvToMatrix from 'csv-to-array- matrix';
8
27
9
- csvToMatrix(pathToFile, callback, delimiter );
28
+ csvToMatrix(pathToFile, callback);
10
29
11
30
function callback(data) {
12
31
const matrix = math.matrix(data);
13
32
}
33
+ ```
34
+
35
+ The default delimiter is ';', but you use a different one.
36
+
37
+ ```
38
+ import csvToMatrix from 'csv-to-array-matrix';
39
+
40
+ csvToMatrix('./src/data.csv', callback, ',');
41
+
42
+ function callback(data) {
43
+ console.log(data);
44
+ }
14
45
```
Original file line number Diff line number Diff line change 1
1
{
2
- "name" : " csv-to-matrix" ,
3
- "version" : " 1.0.0 " ,
4
- "description" : " A CVS to arrays in array (Matrix) parser." ,
2
+ "name" : " csv-to-array- matrix" ,
3
+ "version" : " 0.1.1 " ,
4
+ "description" : " A simple CVS to arrays in array (Matrix) parser." ,
5
5
"main" : " lib/index.js" ,
6
6
"dependencies" : {
7
7
"fast-csv" : " ^2.4.1"
17
17
},
18
18
"repository" : {
19
19
"type" : " git" ,
20
- "url" : " git+https://github.com/rwieruch/csv-to-matrix.git"
20
+ "url" : " git+https://github.com/rwieruch/csv-to-array- matrix.git"
21
21
},
22
22
"keywords" : [],
23
23
"author" : " “Robin <“wrobin@gmx.net”> (https://www.robinwieruch.de)" ,
24
24
"license" : " MIT" ,
25
25
"bugs" : {
26
- "url" : " https://github.com/rwieruch/csv-to-matrix/issues"
26
+ "url" : " https://github.com/rwieruch/csv-to-array- matrix/issues"
27
27
},
28
- "homepage" : " https://github.com/rwieruch/csv-to-matrix#readme"
28
+ "homepage" : " https://github.com/rwieruch/csv-to-array- matrix#readme"
29
29
}
You can’t perform that action at this time.
0 commit comments