Skip to content

Commit 771ccc6

Browse files
pivot kdoc fixes
1 parent 4532390 commit 771ccc6

File tree

5 files changed

+43
-24
lines changed

5 files changed

+43
-24
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ internal interface GroupByDocs {
320320
interface Pivoting
321321

322322
/**
323-
* Grouping key columns can also be created inline:
323+
* Grouping key can also be created inline
324+
* (i.g. by creating a new column using [expr] or simply renaming the old one
325+
* using [named]) :
324326
* ```kotlin
325327
* // Create a new column "newName" based on existing "oldName" values
326328
* // and use it as a grouping key:

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

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ internal interface PivotDocs {
6868
*
6969
* ### Create [Pivot]
7070
*
71-
* [**`pivot`**][pivot]**`(`**`inward: `[`Boolean`][Boolean]**` = true) { `**`pivotColumns: `[`PivotColumnsSelector`][PivotColumnsSelector]**` }`**
71+
* [**`pivot`**][pivot]**`(`**`inward: `[`Boolean`][Boolean]**` = true) { `**`pivotColumns: `[`PivotColumnsSelector`][PivotColumnsSelector]**` }`**
7272
*
7373
* ### Reduce [Pivot] into [DataRow]
7474
*
75-
* [Pivot][Pivot]`.`[**`minBy`**][Pivot.minBy]**` { `**`column: `[`RowExpression`][RowExpression]**` }`**
75+
* [Pivot][Pivot]`.`[**`minBy`**][Pivot.minBy]**` { `**`column: `[`RowExpression`][RowExpression]**` }`**
7676
*
7777
* {@include [Indent]}
78-
* `| `__`.`__[**`maxBy`**][Pivot.maxBy]**` { `**`column: `[`RowExpression`][RowExpression]**` }`**
78+
* `| `__`.`__[**`maxBy`**][Pivot.maxBy]**` { `**`column: `[`RowExpression`][RowExpression]**` }`**
7979
*
8080
* {@include [Indent]}
8181
* `| `__`.`__[**`first`**][Pivot.first]` \[ `**` { `**`rowCondition: `[`RowFilter`][RowFilter]**` } `**`]`
@@ -84,23 +84,23 @@ internal interface PivotDocs {
8484
* `| `__`.`__[**`last`**][Pivot.last]` \[ `**`{ `**`rowCondition: `[`RowFilter`][RowFilter]**` } `**`]`
8585
*
8686
* {@include [Indent]}
87-
* `| `__`.`__[**`medianBy`**][Pivot.medianBy]**` { `**`column: `[`RowExpression`][RowExpression]**` }`**
87+
* `| `__`.`__[**`medianBy`**][Pivot.medianBy]**` { `**`column: `[`RowExpression`][RowExpression]**` }`**
8888
*
8989
* {@include [Indent]}
90-
* `| `__`.`__[**`percentileBy`**][Pivot.percentileBy]**`(`**`percentile: `[`Double`][Double]**`) { `**`column: `[`RowExpression`][RowExpression]**` }`**
90+
* `| `__`.`__[**`percentileBy`**][Pivot.percentileBy]**`(`**`percentile: `[`Double`][Double]**`) { `**`column: `[`RowExpression`][RowExpression]**` }`**
9191
*
9292
* {@include [Indent]}
93-
* __`.`__[**`with`**][Pivot.with]**` { `**`rowExpression: `[`RowExpression`][RowExpression]**` }`**
93+
* __`.`__[**`with`**][Pivot.with]**` { `**`rowExpression: `[`RowExpression`][RowExpression]**` }`**
9494
*
9595
* {@include [Indent]}
9696
* `| `__`.`__[**`values`**][Pivot.values]**` { `**`valueColumns: `[`ColumnsSelector`][ColumnsSelector]**` }`**
9797
*
9898
* ### Aggregate [Pivot] into [DataRow]
9999
*
100-
* [Pivot][Pivot]`.`[**`count`**][Pivot.count]**`() `**
100+
* [Pivot][Pivot]`.`[**`count`**][Pivot.count]**`()`**
101101
*
102102
* {@include [Indent]}
103-
* `| `__`.`__[**`frames`**][Pivot.frames]**`() `**
103+
* `| `__`.`__[**`frames`**][Pivot.frames]**`()`**
104104
*
105105
* {@include [Indent]}
106106
* `| `__`.`__[**`with`**][Pivot.with]**` { `**`rowExpression: `[`RowExpression`][RowExpression]**` }`**
@@ -122,7 +122,7 @@ internal interface PivotDocs {
122122
* `| `__`.`__[**`groupByOther`**][Pivot.groupByOther]**`()`**
123123
*
124124
* {@include [Indent]}
125-
* ` \[ `__`.`__[**`default`**][PivotGroupBy.default]**`(`**`defaultValue`**`) `**`]`
125+
* `\[ `__`.`__[**`default`**][PivotGroupBy.default]**`(`**`defaultValue`**`) `**`]`
126126
*
127127
* {@include [Indent]}
128128
* `| `__`.`__[<pivot_groupBy_reducer>][PivotGroupByDocs.Reducing]
@@ -164,6 +164,8 @@ internal interface PivotDocs {
164164
* (or as [column groups][ColumnGroup]) and values composed of the reduced results from each group.
165165
*
166166
* Check out [`Pivot grammar`][Grammar].
167+
*
168+
* For more information: {@include [DocumentationUrls.PivotReducing]}
167169
*/
168170
interface Reducing
169171

@@ -193,13 +195,15 @@ internal interface PivotDocs {
193195
* (or as [column groups][ColumnGroup]) and values representing the aggregated results of each group.
194196
*
195197
* Check out [`Pivot grammar`][Grammar].
198+
*
199+
* For more information: {@include [DocumentationUrls.PivotAggregation]}
196200
*/
197201
interface Aggregation
198202

199203
/**
200204
* ### [Pivot] grouping
201205
*
202-
* [Pivot] can be pivoted with [groupBy][Pivot.groupBy] method. It will produce a [PivotGroupBy].
206+
* [Pivot] can be grouped with [groupBy][Pivot.groupBy] method. It will produce a [PivotGroupBy].
203207
*
204208
* @include [PivotGroupByDocs.CommonDescription]
205209
*/
@@ -242,7 +246,9 @@ internal interface PivotDocs {
242246
interface AggregationStatistics
243247

244248
/**
245-
* Pivoted columns can also be created inline:
249+
* Pivoted columns can also be created inline
250+
* (i.g. by creating a new column using [expr] or simply renaming the old one
251+
* using [named]) :
246252
* ```kotlin
247253
* // Create a new column "newName" based on existing "oldName" values
248254
* // and pivot it:
@@ -442,16 +448,17 @@ public fun <T> DataFrame<T>.pivot(vararg columns: KProperty<*>, inward: Boolean?
442448
* * Cell values are [Boolean] indicators showing whether matching rows exist
443449
* for each pivoting/grouping key combination.
444450
*/
451+
@ExcludeFromSources
445452
internal interface PivotMatchesResultDescription
446453

447454
/**
448455
* Computes whether matching rows exist in this [DataFrame] for all unique values of the
449-
* selected [\columns] (independently) across all possible combinations
456+
* selected [\columns] across all possible combinations
450457
* of values in the remaining columns (all expecting selected).
451458
*
452459
* Performs a [pivot] operation on the specified [\columns] of this [DataFrame],
453460
* then [groups it by][Pivot.groupByOther] the remaining columns,
454-
* and produces a new matrix-like [DataFrame].
461+
* and produces a new [Boolean] matrix (in the form of a [DataFrame]).
455462
*
456463
* @include [PivotGroupByDocs.ResultingMatrixCommonDescription]
457464
* @include [PivotMatchesResultDescription]
@@ -467,10 +474,12 @@ internal interface PivotMatchesResultDescription
467474
*
468475
* See also:
469476
* * [pivotCounts], which performs a similar operation
470-
* but counts the number of matching rows instead of checking for their presence.
477+
* but counts the number of matching rows instead of checking for their presence
478+
* to produce a count matrix.
471479
*
472480
* ### This `pivotMatches` Overload
473481
*/
482+
@ExcludeFromSources
474483
internal interface DataFramePivotMatchesCommonDocs
475484

476485
/**
@@ -488,7 +497,7 @@ internal interface DataFramePivotMatchesCommonDocs
488497
* @param [inward] If `true` (default), the generated pivoted columns are nested inside the original column;
489498
* if `false`, they are placed at the top level.
490499
* @param [columns] The [Columns Selector][ColumnsSelector] that defines which columns are used as [pivot] keys for the operation.
491-
* @return A new [DataFrame] representing a Boolean presence matrix — with grouping key columns as rows,
500+
* @return A new [DataFrame] representing a [Boolean] presence matrix — with grouping key columns as rows,
492501
* pivot key values as columns, and `true`/`false` cells indicating existing combinations.
493502
*/
494503
public fun <T> DataFrame<T>.pivotMatches(inward: Boolean = true, columns: ColumnsSelector<T, *>): DataFrame<T> =
@@ -532,6 +541,7 @@ public fun <T> DataFrame<T>.pivotMatches(vararg columns: KProperty<*>, inward: B
532541
* * Cell values represent the number of matching rows
533542
* for each pivoting/grouping key combination.
534543
*/
544+
@ExcludeFromSources
535545
internal interface PivotCountsResultDescription
536546

537547
/**
@@ -541,7 +551,7 @@ internal interface PivotCountsResultDescription
541551
*
542552
* Performs a [pivot] operation on the specified [\columns] of this [DataFrame],
543553
* then [groups it by][Pivot.groupByOther] the remaining columns,
544-
* and produces a new matrix-like [DataFrame].
554+
* and produces a new count matrix (in the form of a [DataFrame]).
545555
*
546556
* @include [PivotGroupByDocs.ResultingMatrixCommonDescription]
547557
* @include [PivotCountsResultDescription]
@@ -556,7 +566,8 @@ internal interface PivotCountsResultDescription
556566
* For more information: {@include [DocumentationUrls.PivotCounts]}
557567
*
558568
* See also: [pivotMatches], which performs a similar operation
559-
* but check if there is any matching row instead of counting then.
569+
* but check if there is any matching row instead of counting then
570+
* to produce a [Boolean] matrix.
560571
*
561572
* ### This `pivotCounts` Overload
562573
*/
@@ -1143,7 +1154,7 @@ public interface Pivot<T> : Aggregatable<T>
11431154
/**
11441155
* A specialized [ColumnsSelector] used for selecting columns in a [pivot] operation.
11451156
*
1146-
* Provides a [PivotDsl] both as the receiver and the lambda parameter, and expects
1157+
* Provides [PivotDsl] both as the receiver and the lambda parameter, and expects
11471158
* a [ColumnsResolver] as the return value.
11481159
*
11491160
* Enables defining the hierarchy of pivot columns using [then][PivotDsl.then].
@@ -1201,10 +1212,11 @@ internal interface PivotGroupByDocs {
12011212
interface ResultingMatrixCommonDescription
12021213

12031214
/**
1204-
* [PivotGroupBy] is a dataframe-like structure, combining [Pivot] and [GroupBy]
1205-
* and representing a matrix table with vertical [Pivot] groups (as columns)
1206-
* and horizontal [GroupBy] groups (as rows), and each cell
1207-
* represents a group corresponding both to [GroupBy] and [Pivot] key.
1215+
* [PivotGroupBy] is a dataframe-like structure that combines [Pivot] and [GroupBy],
1216+
* representing a matrix table with vertical [Pivot] groups (as columns)
1217+
* and horizontal [GroupBy] groups (as rows),
1218+
* where each cell represents a group corresponding
1219+
* to both the [GroupBy] and [Pivot] key.
12081220
*
12091221
* Reversed order of `pivot` and `groupBy`
12101222
* (i.e., [DataFrame.pivot] + [Pivot.groupBy] or [DataFrame.groupBy] + [GroupBy.pivot])

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/DocumentationUrls.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ internal interface DocumentationUrls {
174174
/** [See "Pivot` reducing" on the documentation website.]({@include [Url]}/pivot.html#reducing) */
175175
interface PivotReducing
176176

177+
/** [See "Pivot` Aggregation" on the documentation website.]({@include [Url]}/pivot.html#aggregation) */
178+
interface PivotAggregation
179+
177180
/** [See "`pivot` inside aggregation" on the documentation website.]({@include [Url]}/pivot.html#pivot-inside-aggregate) */
178181
interface PivotInsideAggregationStatistics
179182
}

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/documentation/SelectingColumns.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ internal interface SelectingColumns {
5353
@ExcludeFromSources
5454
interface OPERATION
5555

56-
/**
56+
/*
5757
* Operation receiver variable name
5858
*/
5959
@ExcludeFromSources

docs/StardustDocs/topics/pivot.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ df.pivot { city }.groupByOther()
109109
<inline-frame src="resources/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.pivotGroupByOther.html" width="100%"/>
110110
<!---END-->
111111

112+
<!---TODO ## Reducing--->
113+
112114
## Aggregation
113115

114116
To aggregate data groups with one or several statistics use `aggregate`:

0 commit comments

Comments
 (0)