Powered By GitBook
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
}
Returns: Series
Examples

Drop all nan value and then return New Series.

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
let sf_rep = sf.dropna()
6
7
sf_rep.print()
Copied!
Output
1
╔═══╤══════════════════════╗
2
║ │ 0 ║
3
╟───┼──────────────────────╢
4
║ 0 │ 10 ║
5
╟───┼──────────────────────╢
6
║ 1 │ 45 ║
7
╟───┼──────────────────────╢
8
║ 3 │ 10 ║
9
╟───┼──────────────────────╢
10
║ 4 │ 23 ║
11
╟───┼──────────────────────╢
12
║ 5 │ 20 ║
13
╟───┼──────────────────────╢
14
║ 7 │ 10 ║
15
╚═══╧══════════════════════╝
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 ║
3
╟───┼──────────────────────╢
4
║ 0 │ 10 ║
5
╟───┼──────────────────────╢
6
║ 1 │ 45 ║
7
╟───┼──────────────────────╢
8
║ 3 │ 10 ║
9
╟───┼──────────────────────╢
10
║ 4 │ 23 ║
11
╟───┼──────────────────────╢
12
║ 5 │ 20 ║
13
╟───┼──────────────────────╢
14
║ 7 │ 10 ║
15
╚═══╧══════════════════════╝
Copied!
Last modified 24d ago