Skip to content

Latest commit

 

History

History
52 lines (43 loc) · 977 Bytes

series.value_counts.md

File metadata and controls

52 lines (43 loc) · 977 Bytes
description
Count the number of occurrence for each element in a Series

Series.valueCounts

danfo.Series.valueCounts()

Parameters: None

Returns: Series (int element)

Example

{% tabs %} {% tab title="Node" %}

const dfd = require("danfojs-node")

let data1 = [1, 2, 3, 4, 5, 6, 7, 8, 1, 1, 22, 8, 5, 5, 5]
let sf = new dfd.Series(data1)

sf.valueCounts().print()

{% endtab %} {% endtabs %}

{% tabs %} {% tab title="Output" %}

╔════╤═══╗
║ 1  │ 3 ║
╟────┼───╢
║ 2  │ 1 ║
╟────┼───╢
║ 3  │ 1 ║
╟────┼───╢
║ 4  │ 1 ║
╟────┼───╢
║ 5  │ 4 ║
╟────┼───╢
║ 6  │ 1 ║
╟────┼───╢
║ 7  │ 1 ║
╟────┼───╢
║ 8  │ 2 ║
╟────┼───╢
║ 22 │ 1 ║
╚════╧═══╝

{% endtab %} {% endtabs %}