DataFrame.to_csv

Convert DataFrame data to a comma-separated values (csv)

danfo.DataFrame.to_csv(path) [source]

Returns:

returns Promise

Examples

Convert DataFrame to CSV format

Node
Node
const dfd = require("danfojs-node")
let data = { "Abs": [20.2, 30, 47.3] ,
"Count": [34, 4, 5, 6] ,
"country code": ["NG", "FR", "GH"] }
let df = new dfd.DataFrame(data)
df.to_csv("/home/link/to/path.csv").then((csv) => {
console.log(csv);
}).catch((err) => {
console.log(err);
})
Output
Output
Abs,Count,country code
20.2,34,NG
30,4,FR
47.3,5,GH

To export DataFrame as Json, use DataFrame.to_json