aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2022-01-22 22:01:46 -0500
committerPriyansh <[email protected]>2022-01-22 22:01:46 -0500
commit11b97b61f99504442773c546c940af8c82c6cb34 (patch)
tree7804209314ff5324ae7b77924ee992382e70a86e
parentece598200a50a53c9f74fb5252b977c49d571cfb (diff)
downloadizuku.js-11b97b61f99504442773c546c940af8c82c6cb34.tar.xz
izuku.js-11b97b61f99504442773c546c940af8c82c6cb34.zip
docs: readCSV() function added
-rw-r--r--README.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/README.md b/README.md
index 736d49c..94a18d6 100644
--- a/README.md
+++ b/README.md
@@ -227,6 +227,27 @@ const frame = new Frame().fromJSON(json);
// ...continue with other frame methods
```
+### `fromCSV()` ![](https://img.shields.io/badge/chainable-green.svg?style=plastic)
+
+The `fromCSV()` method is used to create a frame from a CSV string. It takes the CSV string as an argument. `fromCSV()` method returns a new frame. You can chain other frame methods on the returned frame.
+
+> **Note:** The `fromCSV()` automatically assigns the column names from the first row of the CSV string. If you do not want to use the column names, you can use the `header()` method to assign the column names first.
+
+```js
+
+const path = require('path');
+const csvPath = path.join(__dirname, 'data.csv');
+
+// Sets the column names from the first row of the CSV
+const frame = new Frame().fromCSV(csvPath);
+
+// Define the column names manually
+const headers = [...];
+
+// Set the header first (important) then read the CSV
+const frame = new Frame().header(headers).fromCSV(csvPath);
+```
+
### `head()` ![](https://img.shields.io/badge/not%20chainable-red.svg?style=plastic)