| description | Returns the first n rows of the DataFrame based on position. |
|---|
danfo.DataFrame.head(rows)
| Parameters | Type | Description | Default |
|---|---|---|---|
| rows | Int | The number of rows to return | 5 |
{% tabs %} {% tab title="Node" %}
const dfd = require("danfojs-node")
let data = { "Name": ["Apples", "Mango", "Banana", "Pear"],
"Count": [21, 5, 30, 10],
"Price": [200, 300, 40, 250] }
let df = new dfd.DataFrame(data)
let s_df = df.head(2)
s_df.print(){% endtab %}
{% tab title="Browser" %}
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="Output" %}
βββββ€ββββββββββββββββββββ€ββββββββββββββββββββ€ββββββββββββββββββββ
β β Name β Count β Price β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 0 β Apples β 21 β 200 β
βββββΌββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ’
β 1 β Mango β 5 β 300 β
βββββ§ββββββββββββββββββββ§ββββββββββββββββββββ§ββββββββββββββββββββ
{% endtab %} {% endtabs %}