Skip to content

Commit 8f9ba09

Browse files
committed
sprinkling around the term "mutually comparable"
1 parent 37d091e commit 8f9ba09

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataColumnType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public fun AnyCol.isList(): Boolean = typeClass == List::class
7676
public fun AnyCol.isComparable(): Boolean = valuesAreComparable()
7777

7878
/**
79-
* Returns `true` if [this] column is intra-comparable, i.e.
79+
* Returns `true` if [this] column is intra-comparable (mutually comparable), i.e.,
8080
* its values can be compared with each other and thus ordered.
8181
*
8282
* If true, operations like [`min()`][AnyCol.min], [`max()`][AnyCol.max], [`median()`][AnyCol.median], etc.

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/TypeUtils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ internal fun Iterable<Any?>.types(): Set<KType> =
696696
}
697697

698698
/**
699-
* Checks whether this KType adheres to `T : Comparable<T & Any>?`, aka, it is comparable with itself.
699+
* Checks whether this KType adheres to `T : Comparable<T & Any>?`, aka, it is mutually comparable with itself.
700700
*/
701701
internal fun KType.isIntraComparable(): Boolean =
702702
this.isSubtypeOf(

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/aggregation/getColumns.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ internal inline fun <T> Aggregatable<T>.remainingColumns(
1818
): ColumnsSelector<T, Any?> = remainingColumnsSelector().filter { predicate(it.data) }
1919

2020
/**
21-
* Emulates selecting all columns whose values are comparable to each other.
21+
* Emulates selecting all columns whose values are mutually comparable to each other.
2222
* These are columns of type `R` where `R : Comparable<R>`.
2323
*
2424
* There is no way to denote this generically in types, however,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class Analyze : TestBase() {
179179
@TransformDataFrameExpressions
180180
fun minmaxModes() {
181181
// SampleStart
182-
df.min() // min of values per every comparable column
182+
df.min() // min of values for every comparable column with mutually comparable values
183183
df.min { age and weight } // min of all values in `age` and `weight`
184184
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
@@ -203,7 +203,7 @@ class Analyze : TestBase() {
203203
@TransformDataFrameExpressions
204204
fun medianModes() {
205205
// SampleStart
206-
df.median() // median of values per every comparable column
206+
df.median() // median of values for every column with mutually comparable values
207207
df.median { age and weight } // median of all values in `age` and `weight`
208208
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
@@ -227,7 +227,7 @@ class Analyze : TestBase() {
227227
@TransformDataFrameExpressions
228228
fun percentileModes() {
229229
// SampleStart
230-
df.percentile(25.0) // 25th percentile of values per every comparable column
230+
df.percentile(25.0) // 25th percentile of values for every column with mutually comparable values
231231
df.percentile(75.0) { age and weight } // 75th percentile of all values in `age` and `weight`
232232
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
@@ -638,7 +638,7 @@ class Analyze : TestBase() {
638638
@TransformDataFrameExpressions
639639
fun groupByDirectAggregations_properties() {
640640
// SampleStart
641-
df.groupBy { city }.max() // max for every comparable column
641+
df.groupBy { city }.max() // max for every column with mutually comparable values
642642
df.groupBy { city }.mean() // mean for every numeric column
643643
df.groupBy { city }.max { age } // max age into column "age"
644644
df.groupBy { city }.sum("total weight") { weight } // sum of weights into column "total weight"
@@ -657,7 +657,7 @@ class Analyze : TestBase() {
657657
@TransformDataFrameExpressions
658658
fun groupByDirectAggregations_strings() {
659659
// SampleStart
660-
df.groupBy("city").max() // max for every comparable column
660+
df.groupBy("city").max() // max for every column with mutually comparable values
661661
df.groupBy("city").mean() // mean for every numeric column
662662
df.groupBy("city").max("age") // max age into column "age"
663663
df.groupBy("city").sum("weight", name = "total weight") // sum of weights into column "total weight"

docs/StardustDocs/topics/median.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ In these cases, the return type is always `Double?`.
1717
When the number of values is even, the median is the average of the two middle values.
1818

1919
The operation is also available for self-comparable columns
20-
(so columns of type `T : Comparable<T>`, like `DateTime`, `String`, etc.)
20+
(so columns of type `T : Comparable<T>`, whose values are mutually comparable, like `DateTime`, `String`, etc.)
2121
In this case, the return type remains `T?`.
2222
When the number of values is even, the median is the low of the two middle values.
2323
NOTE: This logic also applies to other self-comparable `Number` types, like `BigDecimal`.

docs/StardustDocs/topics/minmax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The operations either throw an exception when the input is empty (after filterin
99
or they return `null` when using the `-orNull` overloads.
1010

1111
They are available for self-comparable columns
12-
(so columns of type `T : Comparable<T>`, like `DateTime`, `String`, `Int`, etc.)
12+
(so columns of type `T : Comparable<T>`, whose values are mutually comparable, like `DateTime`, `String`, etc.)
1313
which includes all primitive number columns, but no mix of different number types.
1414

1515
All operations on `Double`/`Float` have the `skipNaN` option, which is

docs/StardustDocs/topics/percentile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ The results of the operation on these types are interpolated using
2121
[Quantile Estimation Method](#quantile-estimation-methods) R8.
2222

2323
The operation is also available for self-comparable columns
24-
(so columns of type `T : Comparable<T>`, like `DateTime`, `String`, etc.)
24+
(so columns of type `T : Comparable<T>`, whose values are mutually comparable, like `DateTime`, `String`, etc.)
2525
In this case, the return type remains `T?`.
2626
The index of the result of the operation on these types is rounded using
2727
[Quantile Estimation Method](#quantile-estimation-methods) R3.

docs/StardustDocs/topics/summaryStatistics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ df.pivot { city }.groupBy { name.lastName }.std()
3636
[sum](sum.md), [mean](mean.md), [std](std.md) are available for (primitive) number columns of types
3737
`Int`, `Double`, `Float`, `Long`, `Byte`, `Short`, and any mix of those.
3838

39-
[min/max](minmax.md), [median](median.md), and [percentile](percentile.md) are available for self-comparable columns
40-
(so columns of type `T : Comparable<T>`, like `DateTime`, `String`, `Int`, etc.)
39+
[min/max](minmax.md), [median](median.md), and [percentile](percentile.md) are available for self-comparable columns
40+
(so columns of type `T : Comparable<T>`, whose values are mutually comparable, like `DateTime`, `String`, etc.)
4141
which includes all primitive number columns, but no mix of different number types.
4242

4343
In all cases, `null` values are ignored.

0 commit comments

Comments
 (0)