inplace: Boolean indicating whether to perform the operation inplace or not. Defaults to false
{ inplace:false}
resetIndex is useful when the index needs to be treated as a column, or when the index is meaningless and needs to be reset to default, before another operation.
Reset index to default values
Node
Browser
1
const dfd =require("danfojs-node")
2
let data =[20,30,40]
3
let sf =newdfd.Series(data,{index:["a","b","c"]})
4
sf.print()
5
6
let sf_reset = sf.resetIndex()
7
sf_reset.print()
Copied!
1
Copied!
Output
1
╔═══╤════╗
2
║ a │ 20 ║
3
╟───┼────╢
4
║ b │ 30 ║
5
╟───┼────╢
6
║ c │ 40 ║
7
╚═══╧════╝
8
9
╔═══╤════╗
10
║ 0 │ 20 ║
11
╟───┼────╢
12
║ 1 │ 30 ║
13
╟───┼────╢
14
║ 2 │ 40 ║
15
╚═══╧════╝
Copied!
Reset index to new values in-place
Node
Browser
1
let data =[1,2,3,4,5,6]
2
let sf =newdfd.Series(data,{index:['a','b','c','d','e','f']})