Series.valueCounts
Count the number of occurrence for each element in a Series
danfo.Series.valueCounts()
Parameters: None
Returns: Series (int element)
Example
Node
1
const dfd = require("danfojs-node")
2
3
let data1 = [1, 2, 3, 4, 5, 6, 7, 8, 1, 1, 22, 8, 5, 5, 5]
4
let sf = new dfd.Series(data1)
5
6
sf.valueCounts().print()
Copied!
Output
1
╔════╤═══╗
2
║ 1 │ 3 ║
3
╟────┼───╢
4
║ 2 │ 1 ║
5
╟────┼───╢
6
║ 3 │ 1 ║
7
╟────┼───╢
8
║ 4 │ 1 ║
9
╟────┼───╢
10
║ 5 │ 4 ║
11
╟────┼───╢
12
║ 6 │ 1 ║
13
╟────┼───╢
14
║ 7 │ 1 ║
15
╟────┼───╢
16
║ 8 │ 2 ║
17
╟────┼───╢
18
║ 22 │ 1 ║
19
╚════╧═══╝
Copied!
Copy link