diff options
| author | Priyansh <[email protected]> | 2022-01-22 22:01:46 -0500 |
|---|---|---|
| committer | Priyansh <[email protected]> | 2022-01-22 22:01:46 -0500 |
| commit | 11b97b61f99504442773c546c940af8c82c6cb34 (patch) | |
| tree | 7804209314ff5324ae7b77924ee992382e70a86e | |
| parent | ece598200a50a53c9f74fb5252b977c49d571cfb (diff) | |
| download | izuku.js-11b97b61f99504442773c546c940af8c82c6cb34.tar.xz izuku.js-11b97b61f99504442773c546c940af8c82c6cb34.zip | |
docs: readCSV() function added
| -rw-r--r-- | README.md | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -227,6 +227,27 @@ const frame = new Frame().fromJSON(json); // ...continue with other frame methods ``` +### `fromCSV()`  + +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()`  |
