Series.dropNa
Remove missing values from Series
danfo.Series.dropNa(options) [source]
Parameters
Type
Description
Default
options
Object
inplace: Boolean indicating whether to perform the operation inplace or not. Defaults to false
{ inplace: false
}

Drop all missing values and then return New Series.

Node
1
const dfd = require("danfojs-node")
2
3
let data1 = [10, 45, undefined, 10, 23, 20, null, 10]
4
let sf = new dfd.Series(data1)
5
let sf_rep = sf.dropNa()
6
7
sf_rep.print()
Copied!
Output
1
╔═══╤════╗
2
║ 0 │ 10 ║
3
╟───┼────╢
4
║ 1 │ 45 ║
5
╟───┼────╢
6
║ 3 │ 10 ║
7
╟───┼────╢
8
║ 4 │ 23 ║
9
╟───┼────╢
10
║ 5 │ 20 ║
11
╟───┼────╢
12
║ 7 │ 10 ║
13
╚═══╧════╝
Copied!

Drop nan values in-place

Node
1
const dfd = require("danfojs-node")
2
3
let data1 = [10, 45, undefined, 10, 23, 20, undefined, 10]
4
let sf = new dfd.Series(data1)
5
sf.dropNa({inplace:true})
6
7
sf.print()
Copied!
Output
1
╔═══╤════╗
2
║ 0 │ 10 ║
3
╟───┼────╢
4
║ 1 │ 45 ║
5
╟───┼────╢
6
║ 3 │ 10 ║
7
╟───┼────╢
8
║ 4 │ 23 ║
9
╟───┼────╢
10
║ 5 │ 20 ║
11
╟───┼────╢
12
║ 7 │ 10 ║
13
╚═══╧════╝
Copied!