Data loading and working with different file formats
In this section, we will look at how to work with different file formats. Danfo.js provides a method for working with three different file formats: CSV, Excel, and JSON. Data presented in these formats can easily be read and presented as a DataFrame.
The following are the methods needed for each of the file formats:
read_csv()
: To read CSV filesread_json()
: To read JSON filesread_excel()
: To read Excel files presented as.xslx
Each of these methods can read data locally and from the internet. Also, these methods only have access to the local files in a Node.js
environment. On the web, these methods can read provided files (CSV, JSON, and .xslx
files) provided these files are available on the internet.
Let's see how to read local files in the Node.js environment:
const dfd = require("Danfo.Js-node") dfd.read_csv('titanic.csv').then(df => { df.head().print()...