Skip to content

Commit 7772835

Browse files
committed
updated doc examples for xxFor {} statistics to show types can now be mixed. Also tests compilation
1 parent 623bf18 commit 7772835

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Analyze.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class Analyze : TestBase() {
181181
// SampleStart
182182
df.min() // min of values per every comparable column
183183
df.min { age and weight } // min of all values in `age` and `weight`
184-
df.minFor(skipNaN = true) { age and weight } // min of values per `age` and `weight` separately
184+
df.minFor(skipNaN = true) { age and name.firstName } // min of values per `age` and `firstName` separately
185185
df.minOf { (weight ?: 0) / age } // min of expression evaluated for every row
186186
df.minBy { age } // DataRow with minimal `age`
187187
// SampleEnd
@@ -205,7 +205,7 @@ class Analyze : TestBase() {
205205
// SampleStart
206206
df.median() // median of values per every comparable column
207207
df.median { age and weight } // median of all values in `age` and `weight`
208-
df.medianFor(skipNaN = true) { age and weight } // median of values per `age` and `weight` separately
208+
df.medianFor(skipNaN = true) { age and name.firstName } // median of values per `age` and `firstName` separately
209209
df.medianOf { (weight ?: 0) / age } // median of expression evaluated for every row
210210
df.medianBy { age } // DataRow where the median age lies (lower-median for an even number of values)
211211
// SampleEnd
@@ -229,7 +229,7 @@ class Analyze : TestBase() {
229229
// SampleStart
230230
df.percentile(25.0) // 25th percentile of values per every comparable column
231231
df.percentile(75.0) { age and weight } // 75th percentile of all values in `age` and `weight`
232-
df.percentileFor(50.0, skipNaN = true) { age and weight } // 50th percentile of values per `age` and `weight` separately
232+
df.percentileFor(50.0, skipNaN = true) { age and name.firstName } // 50th percentile of values per `age` and `firstName` separately
233233
df.percentileOf(75.0) { (weight ?: 0) / age } // 75th percentile of expression evaluated for every row
234234
df.percentileBy(25.0) { age } // DataRow where the 25th percentile of `age` lies (index rounded using R3)
235235
// SampleEnd
@@ -438,7 +438,7 @@ class Analyze : TestBase() {
438438
fun columnsFor_properties() {
439439
// SampleStart
440440
df.minFor { colsOf<Int>() }
441-
df.maxFor { name.firstName and name.lastName }
441+
df.maxFor { name.firstName and age }
442442
df.sumFor { age and weight }
443443
df.meanFor { cols(1, 3).asNumbers() }
444444
df.medianFor { name.allCols().asComparable() }
@@ -457,7 +457,7 @@ class Analyze : TestBase() {
457457

458458
df.minFor { colsOf<Int>() }
459459

460-
df.maxFor { firstName and lastName }
460+
df.maxFor { firstName and age }
461461
// or
462462
df.maxFor(firstName, lastName)
463463

@@ -475,7 +475,7 @@ class Analyze : TestBase() {
475475
fun columnsFor_strings() {
476476
// SampleStart
477477
df.minFor { colsOf<Int>() }
478-
df.maxFor { "name"["firstName"].asComparable() and "name"["lastName"].asComparable() }
478+
df.maxFor { "name"["firstName"].asComparable() and "age"<Int>() }
479479

480480
df.sumFor("age", "weight")
481481
// or

docs/StardustDocs/resources/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.columnsFor.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
</details>
195195
<br>
196196
<details>
197-
<summary>df.maxFor { name.firstName and name.lastName }</summary>
197+
<summary>df.maxFor { name.firstName and age }</summary>
198198
<details>
199199
<summary>Input DataFrame: rowsCount = 7, columnsCount = 5</summary>
200200
<table class="dataframe" id="df_2"></table>
@@ -668,7 +668,7 @@
668668

669669
/*<!--*/
670670
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"firstName: String\">firstName</span>", children: [], rightAlign: false, values: ["Charlie"] },
671-
{ name: "<span title=\"lastName: String\">lastName</span>", children: [], rightAlign: false, values: ["Wolf"] },
671+
{ name: "<span title=\"age: Int\">age</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">45</span></span>"] },
672672
], id: 3, rootId: 3, totalRows: 1 } ) });
673673
/*-->*/
674674

docs/StardustDocs/topics/median.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ When it's set to `true`, `NaN` values are ignored.
3030
```kotlin
3131
df.median() // median of values per every comparable column
3232
df.median { age and weight } // median of all values in `age` and `weight`
33-
df.medianFor(skipNaN = true) { age and weight } // median of values per `age` and `weight` separately
33+
df.medianFor(skipNaN = true) { age and name.firstName } // median of values per `age` and `firstName` separately
3434
df.medianOf { (weight ?: 0) / age } // median of expression evaluated for every row
3535
df.medianBy { age } // DataRow where the median age lies (lower-median for an even number of values)
3636
```

docs/StardustDocs/topics/minmax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ When it's set to `true`, `NaN` values are ignored.
2121
```kotlin
2222
df.min() // min of values per every comparable column
2323
df.min { age and weight } // min of all values in `age` and `weight`
24-
df.minFor(skipNaN = true) { age and weight } // min of values per `age` and `weight` separately
24+
df.minFor(skipNaN = true) { age and name.firstName } // min of values per `age` and `firstName` separately
2525
df.minOf { (weight ?: 0) / age } // min of expression evaluated for every row
2626
df.minBy { age } // DataRow with minimal `age`
2727
```

docs/StardustDocs/topics/percentile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ In the future we might add an option to change the quantile estimation method.
5252
```kotlin
5353
df.percentile(25.0) // 25th percentile of values per every comparable column
5454
df.percentile(75.0) { age and weight } // 75th percentile of all values in `age` and `weight`
55-
df.percentileFor(50.0, skipNaN = true) { age and weight } // 50th percentile of values per `age` and `weight` separately
55+
df.percentileFor(50.0, skipNaN = true) { age and name.firstName } // 50th percentile of values per `age` and `firstName` separately
5656
df.percentileOf(75.0) { (weight ?: 0) / age } // 75th percentile of expression evaluated for every row
5757
df.percentileBy(25.0) { age } // DataRow where the 25th percentile of `age` lies (index rounded using R3)
5858
```

0 commit comments

Comments
 (0)