Kotlin / Kotlin/dataframe

Exception in documentation example of `toDataFrame`

Open
#1,401 6 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
1.1k
Forks
83
Avg merge
4d 12h
Merged PRs (30d)
30

Description

In [Operations/Create/DataFrame](https://kotlin.github.io/dataframe/createdataframe.html#todataframe) we have:

```kt
val df = students.toDataFrame {
// add column
"year of birth" from { 2021 - it.age }

// scan all properties
properties(maxDepth = 1) {
exclude(Score::subject) // `subject` property will be skipped from object graph traversal
preserve() // `Name` objects will be stored as-is without transformation into DataFrame
}

// add column group
"summary" {
"max score" from { it.scores.maxOf { it.value } }
"min score" from { it.scores.minOf { it.value } }
}
}
```
Executing this in a Kotlin Notebook cell results in: `Exception while analyzing expression in (13,28) in Line_123.jupyter.kts`

Line 13 refers to `"max score" from { it.scores.maxOf { it.value } }`

Gradle settings:

```kts
plugins {
kotlin("jvm") version "2.2.20-Beta1"
kotlin("plugin.dataframe") version "2.2.20-Beta1"
}

dependencies {
implementation("org.jetbrains.kotlinx:dataframe:1.0.0-Beta2")
testImplementation(kotlin("test"))
}

```

Contributor guide

Open the contributing guide

Research direction

Start with the `Operations/Create/DataFrame` documentation example at the linked `toDataFrame` section, using the supplied Kotlin and DataFrame Gradle versions in a Kotlin Notebook. Reproduce the exception on the `"max score" from` line and determine the documentation change needed so the example executes without that error.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.