danfo.streamCSV
Streams a CSV file from a local or remote location in chunks. Each intermediate chunk is passed as a DataFrame to the callback function.
Parameters
Type
Description
Stream CSV file from local path
const dfd = require("danfojs-node")
const path = require("path")
const filePath = path.join(process.cwd(), "raw_data", "titanic.csv");
dfd.streamCSV(filePath, (df) => {
if (df) {
// Do any processing here
df.print();
}
});//Showing few rows
...
╔════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╗
║ │ PassengerId │ Survived │ Pclass │ Name │ ... │ Fare │ Cabin │ Embarked ║
╟────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 676 │ 687 │ 0 │ 3 │ Panula, Mr. Jaa… │ ... │ 39.6875 │ │ S ║
╚════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╝
╔════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╤═══════════════════╗
║ │ PassengerId │ Survived │ Pclass │ Name │ ... │ Fare │ Cabin │ Embarked ║
╟────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────╢
║ 677 │ 688 │ 0 │ 3 │ Dakic, Mr. Bran… │ ... │ 10.1708 │ │ S ║
╚════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╧═══════════════════╝
...Stream CSV file from remote path
Last updated