diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/pivot.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/pivot.kt index 8b8f02e66..4b6721f2c 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/pivot.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/pivot.kt @@ -486,8 +486,9 @@ internal interface DataFramePivotMatchesCommonDocs /** * @include [DataFramePivotMatchesCommonDocs] - * @include [SelectingColumns.Dsl] + * Select or express pivot columns using the [PivotDsl]. * + * @include [PivotDslDocs] * ### Example * ```kotlin * // Compute whether matching rows exist for all unique values of "city" @@ -498,11 +499,11 @@ internal interface DataFramePivotMatchesCommonDocs * * @param [inward] If `true` (default), the generated pivoted columns are nested inside the original column; * if `false`, they are placed at the top level. - * @param [columns] The [Columns Selector][ColumnsSelector] that defines which columns are used as [pivot] keys for the operation. + * @param [columns] The [Pivot Columns Selector][PivotColumnsSelector] that defines which columns are used as [pivot] keys for the operation. * @return A new [DataFrame] representing a [Boolean] presence matrix — with grouping key columns as rows, * pivot key values as columns, and `true`/`false` cells indicating existing combinations. */ -public fun DataFrame.pivotMatches(inward: Boolean = true, columns: ColumnsSelector): DataFrame = +public fun DataFrame.pivotMatches(inward: Boolean = true, columns: PivotColumnsSelector): DataFrame = pivot(inward, columns).groupByOther().matches() /** @@ -577,7 +578,9 @@ internal interface DataFramePivotCountsCommonDocs /** * @include [DataFramePivotCountsCommonDocs] - * @include [SelectingColumns.Dsl] + * Select or express pivot columns using the [PivotDsl]. + * + * @include [PivotDslDocs] * * ### Example * ```kotlin @@ -588,11 +591,11 @@ internal interface DataFramePivotCountsCommonDocs * ``` * * @include [PivotDocs.InwardKDocs] - * @param [columns] The [Columns Selector][ColumnsSelector] that defines which columns are used as [pivot] keys for the operation. + * @param [columns] The [Pivot Columns Selector][PivotColumnsSelector] that defines which columns are used as [pivot] keys for the operation. * @return A new [DataFrame] representing a counting matrix — with grouping key columns as rows, * pivot key values as columns, and the number of rows with the corresponding combinations in the cells. */ -public fun DataFrame.pivotCounts(inward: Boolean = true, columns: ColumnsSelector): DataFrame = +public fun DataFrame.pivotCounts(inward: Boolean = true, columns: PivotColumnsSelector): DataFrame = pivot(inward, columns).groupByOther().count() /** @@ -655,11 +658,11 @@ private interface CommonPivotForGroupByDocs * @include [CommonPivotForGroupByDocs] * @include [SelectingColumns.Dsl.WithExample] {@include [SetPivotOperationArg] {@set [SelectingColumns.RECEIVER] `gb`}} * @include [PivotDocs.InwardKDocsForGrouped] - * @param [columns] The [Columns Selector][ColumnsSelector] that defines which columns are pivoted. + * @param [columns] The [Pivot Columns Selector][PivotColumnsSelector] that defines which columns are pivoted. * @return A new [PivotGroupBy] that preserves the original [groupBy] key columns * and pivots the provided columns. */ -public fun GroupBy<*, G>.pivot(inward: Boolean = true, columns: ColumnsSelector): PivotGroupBy = +public fun GroupBy<*, G>.pivot(inward: Boolean = true, columns: PivotColumnsSelector): PivotGroupBy = PivotGroupByImpl(this, columns, inward) @Deprecated(DEPRECATED_ACCESS_API) @@ -713,7 +716,9 @@ internal interface GroupByPivotMatchesCommonDocs /** * @include [GroupByPivotMatchesCommonDocs] - * @include [SelectingColumns.Dsl] + * Select or express pivot columns using the [PivotDsl]. + * + * @include [PivotDslDocs] * * ### Example * ```kotlin @@ -723,11 +728,11 @@ internal interface GroupByPivotMatchesCommonDocs * ``` * * @include [PivotDocs.InwardKDocsForGrouped] - * @param [columns] The [Columns Selector][ColumnsSelector] that defines which columns are used as [pivot] keys for the operation. + * @param [columns] The [Pivot Columns Selector][PivotColumnsSelector] that defines which columns are used as [pivot] keys for the operation. * @return A new [DataFrame] representing a Boolean presence matrix — with grouping key columns as rows, * pivot key values as columns, and `true`/`false` cells indicating existing combinations. */ -public fun GroupBy<*, G>.pivotMatches(inward: Boolean = true, columns: ColumnsSelector): DataFrame = +public fun GroupBy<*, G>.pivotMatches(inward: Boolean = true, columns: PivotColumnsSelector): DataFrame = pivot(inward, columns).matches() /** @@ -787,7 +792,9 @@ internal interface GroupByPivotCountsCommonDocs /** * @include [GroupByPivotCountsCommonDocs] - * @include [SelectingColumns.Dsl] + * Select or express pivot columns using the [PivotDsl]. + * + * @include [PivotDslDocs] * * ### Example * ```kotlin @@ -797,11 +804,11 @@ internal interface GroupByPivotCountsCommonDocs * ``` * * @include [PivotDocs.InwardKDocsForGrouped] - * @param [columns] The [Columns Selector][ColumnsSelector] that defines which columns are used as [pivot] keys for the operation. + * @param [columns] The [Pivot Columns Selector][PivotColumnsSelector] that defines which columns are used as [pivot] keys for the operation. * @return A new [DataFrame] representing a counting matrix — with grouping key columns as rows, * pivot key values as columns, and the number of rows with the corresponding combinations in the cells. */ -public fun GroupBy<*, G>.pivotCounts(inward: Boolean = true, columns: ColumnsSelector): DataFrame = +public fun GroupBy<*, G>.pivotCounts(inward: Boolean = true, columns: PivotColumnsSelector): DataFrame = pivot(inward, columns).count() /** @@ -936,8 +943,7 @@ public fun AggregateGroupedDsl.pivot( * ``` * * @include [PivotDocs.InwardKDocsForGrouped] - * @param columns The [Pivot Columns Selector][PivotColumnsSelector] that defines which columns are used - * as keys for pivoting and in which order. + * @param [columns] The [Column Names][String] that defines which columns are used as [pivot] keys for the operation. * @return A [PivotGroupBy] for further [aggregations][PivotGroupByDocs.Aggregation]. */ public fun AggregateGroupedDsl.pivot(vararg columns: String, inward: Boolean = true): PivotGroupBy = @@ -983,7 +989,9 @@ internal interface AggregateGroupedDslPivotMatchesDocs /** * @include [AggregateGroupedDslPivotMatchesDocs] - * @include [SelectingColumns.Dsl] + * Select or express pivot columns using the [PivotDsl]. + * + * @include [PivotDslDocs] * ### Example * ```kotlin * df.groupBy { name.firstName }.aggregate { @@ -994,7 +1002,7 @@ internal interface AggregateGroupedDslPivotMatchesDocs * ``` * * @include [PivotDocs.InwardKDocsForGrouped] - * @param columns The [Columns Selector][ColumnsSelector] that defines which columns are used + * @param columns The [Pivot Columns Selector][PivotColumnsSelector] that defines which columns are used * as keys for pivoting and in which order. * @return A new [DataFrame] representing a Boolean presence matrix — with grouping key columns as rows, * pivot key values as columns, and `true`/`false` cells indicating existing combinations. @@ -1002,7 +1010,7 @@ internal interface AggregateGroupedDslPivotMatchesDocs */ public fun AggregateGroupedDsl.pivotMatches( inward: Boolean = true, - columns: ColumnsSelector, + columns: PivotColumnsSelector, ): DataFrame = pivot(inward, columns).matches() /** @@ -1067,10 +1075,11 @@ internal interface AggregateGroupedDslPivotCountsDocs /** * @include [AggregateGroupedDslPivotCountsDocs] - * @include [SelectingColumns.Dsl] + * Select or express pivot columns using the [PivotDsl]. + * + * @include [PivotDslDocs] * ### Example * ```kotlin - * ```kotlin * df.groupBy { name.firstName }.aggregate { * // Compute number of for all unique values of "city" * // across all "name.firstName" key values and adds it to the aggregation result @@ -1079,7 +1088,7 @@ internal interface AggregateGroupedDslPivotCountsDocs * ``` * * @include [PivotDocs.InwardKDocsForGrouped] - * @param columns The [Columns Selector][ColumnsSelector] that defines which columns are used + * @param columns The [Pivot Columns Selector][PivotColumnsSelector] that defines which columns are used * as keys for pivoting and in which order. * @return A new [DataFrame] representing a counting matrix — with grouping key columns as rows, * pivot key values as columns, and the number of rows with the corresponding combinations in the cells. @@ -1087,7 +1096,7 @@ internal interface AggregateGroupedDslPivotCountsDocs */ public fun AggregateGroupedDsl.pivotCounts( inward: Boolean = true, - columns: ColumnsSelector, + columns: PivotColumnsSelector, ): DataFrame = pivot(inward, columns).count() /**