DataFrame.index
The index (row labels) of the DataFrame.
danfo.DataFrame.index [source]

Examples

Returns auto-generated index of a DataFrame
Node
Browser
1
const dfd = require("danfojs-node")
2
3
let data = {"A": [-20.1, 30, 47.3, -20],
4
"B": [34, -4, 5, 6],
5
"C": [20, -20, 30, -40]}
6
let df = new dfd.DataFrame(data)
7
8
console.log(df.index);
Copied!
1
Copied!
Output
1
[0, 1, 2, 3]
Copied!
Node
Browser
1
const dfd = require("danfojs-node")
2
3
let data = {"A": [-20.1, 30, 47.3, -20],
4
"B": [34, -4, 5, 6],
5
"C": [20, -20, 30, -40]}
6
let df = new dfd.DataFrame(data, {index: ["r1", "r2", "r3", "r4"])
7
8
console.log(df.index);
Copied!
1
Copied!
Output
1
[ 'r1', 'r2', 'r3', 'r4' ]
Copied!
Last modified 17d ago
Copy link
Contents
Examples