Kotlin / Kotlin/dataframe

Add KDoc and improve docs/tests for `head`

Open
#1,964 0 comments 0 reactions 1 assignee Claimed by @zaleslaw View on GitHub
KDocs tests
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

## Add KDoc and improve docs/tests for `head`

`core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/head.kt` contains a simple public shortcut without KDoc:

```kotlin
public fun DataFrame.head(numRows: Int = 5): DataFrame = take(numRows)
```

The site page exists, but it is very brief:
https://kotlin.github.io/dataframe/head.html

There is no dedicated unit test file for `head`; behavior is likely covered indirectly through `take`.

### Scope

- Add concise KDoc for `DataFrame.head`.
- Add one minimal direct unit test for `head`.
- Slightly improve the site page with a small input/output example.

### Suggested behavior description

`head` returns a dataframe containing the first `numRows` rows. By default, it returns the first 5 rows. It is a shortcut for `take(numRows)`.

### Test scenario

- Given a dataframe with more than 5 rows.
- `df.head()` returns the first 5 rows.
- `df.head(3)` returns the first 3 rows.
- Result is equal to `df.take(...)`.

### Acceptance criteria

- `DataFrame.head` has KDoc.
- There is at least one direct unit test for `head`.
- Site docs include a small input/output example and mention that `head` is equivalent to `take(numRows)`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.