diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/ColumnsContainer.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/ColumnsContainer.kt new file mode 100644 index 000000000..85af9ee02 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/ColumnsContainer.kt @@ -0,0 +1,86 @@ +package org.jetbrains.kotlinx.dataframe + +import org.jetbrains.kotlinx.dataframe.api.ColumnSelectionDsl +import org.jetbrains.kotlinx.dataframe.api.asColumnGroup +import org.jetbrains.kotlinx.dataframe.api.cast +import org.jetbrains.kotlinx.dataframe.api.castFrameColumn +import org.jetbrains.kotlinx.dataframe.api.getColumn +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.columns.asAnyFrameColumn +import kotlin.reflect.KProperty + +/** + * Provides access to [columns][DataColumn]. + * + * Base interface for [DataFrame] and [ColumnSelectionDsl] + * + * @param T Schema marker. Used to generate extension properties for typed column access. + */ +public interface ColumnsContainer { + + // region columns + + public fun columns(): List + + public fun columnsCount(): Int + + public fun containsColumn(name: String): Boolean + + public fun containsColumn(path: ColumnPath): Boolean + + public fun getColumnIndex(name: String): Int + + // endregion + + // region getColumnOrNull + + public fun getColumnOrNull(name: String): AnyCol? + + public fun getColumnOrNull(index: Int): AnyCol? + + public fun getColumnOrNull(column: ColumnReference): DataColumn? + + public fun getColumnOrNull(column: KProperty): DataColumn? + + public fun getColumnOrNull(path: ColumnPath): AnyCol? + + public fun getColumnOrNull(column: ColumnSelector): DataColumn? + + // endregion + + // region get + + public operator fun get(columnName: String): AnyCol = getColumn(columnName) + + public operator fun get(columnPath: ColumnPath): AnyCol = getColumn(columnPath) + + public operator fun get(column: DataColumn): DataColumn = getColumn(column.name()).cast() + + public operator fun get(column: DataColumn>): ColumnGroup = getColumn(column) + + public operator fun get(column: DataColumn>): FrameColumn = getColumn(column) + + public operator fun get(column: ColumnReference): DataColumn = getColumn(column) + + public operator fun get(column: ColumnReference>): ColumnGroup = getColumn(column) + + public operator fun get(column: ColumnReference>): FrameColumn = getColumn(column) + + public operator fun get(column: KProperty): DataColumn = get(column.columnName).cast() + + public operator fun get(column: KProperty>): ColumnGroup = + get(column.columnName).asColumnGroup().cast() + + public operator fun get(column: KProperty>): FrameColumn = + get(column.columnName).asAnyFrameColumn().castFrameColumn() + + public fun get(columns: ColumnsSelector): List> + + public fun get(column: ColumnSelector): DataColumn = get(column as ColumnsSelector).single() + + // endregion +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt new file mode 100644 index 000000000..b61c9ae2d --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt @@ -0,0 +1,153 @@ +package org.jetbrains.kotlinx.dataframe + +import org.jetbrains.kotlinx.dataframe.api.Infer +import org.jetbrains.kotlinx.dataframe.api.asDataColumn +import org.jetbrains.kotlinx.dataframe.api.cast +import org.jetbrains.kotlinx.dataframe.api.concat +import org.jetbrains.kotlinx.dataframe.api.filter +import org.jetbrains.kotlinx.dataframe.api.map +import org.jetbrains.kotlinx.dataframe.api.schema +import org.jetbrains.kotlinx.dataframe.api.take +import org.jetbrains.kotlinx.dataframe.columns.BaseColumn +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnKind +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnResolutionContext +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.ValueColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnGroupImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.FrameColumnImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.ValueColumnImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.addPath +import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType +import org.jetbrains.kotlinx.dataframe.impl.columns.toColumnKind +import org.jetbrains.kotlinx.dataframe.impl.getValuesType +import org.jetbrains.kotlinx.dataframe.impl.splitByIndices +import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema +import kotlin.reflect.KClass +import kotlin.reflect.KProperty +import kotlin.reflect.KType +import kotlin.reflect.typeOf + +/** + * Column with [name] and [values] of specific [type]. + * + * Base interface for [ValueColumn] and [FrameColumn], but not for [ColumnGroup]. However, implementations for all three [column kinds][ColumnKind] derive from DataColumn and can cast to it safely. + * Column operations that have signature clash with [DataFrame] API ([filter], [take], [map] etc.) are defined for [DataColumn] and not for [BaseColumn]. + * + * @param T type of values in the column. + */ +public interface DataColumn : BaseColumn { + + public companion object { + + /** + * Creates [ValueColumn] using given [name], [values] and [type]. + * + * @param name name of the column + * @param values list of column values + * @param type type of the column + * @param infer column type inference mode + */ + public fun createValueColumn( + name: String, + values: List, + type: KType, + infer: Infer = Infer.None, + defaultValue: T? = null, + ): ValueColumn = ValueColumnImpl(values, name, getValuesType(values, type, infer), defaultValue) + + /** + * Creates [ValueColumn] using given [name], [values] and reified column [type]. + * + * Note, that column [type] will be defined at compile-time using [T] argument + * + * @param T type of the column + * @param name name of the column + * @param values list of column values + * @param infer column type inference mode + */ + public inline fun createValueColumn( + name: String, + values: List, + infer: Infer = Infer.None, + ): ValueColumn = + createValueColumn( + name, + values, + getValuesType( + values, + typeOf(), + infer, + ), + ) + + public fun createColumnGroup(name: String, df: DataFrame): ColumnGroup = ColumnGroupImpl(name, df) + + public fun createFrameColumn(name: String, df: DataFrame, startIndices: Iterable): FrameColumn = + FrameColumnImpl(name, df.splitByIndices(startIndices.asSequence()).toList(), lazy { df.schema() }) + + public fun createFrameColumn( + name: String, + groups: List>, + schema: Lazy? = null, + ): FrameColumn = FrameColumnImpl(name, groups, schema) + + public fun createWithTypeInference( + name: String, + values: List, + nullable: Boolean? = null, + ): DataColumn = guessColumnType(name, values, nullable = nullable) + + public fun create( + name: String, + values: List, + type: KType, + infer: Infer = Infer.None, + ): DataColumn = + when (type.toColumnKind()) { + ColumnKind.Value -> createValueColumn(name, values, type, infer) + ColumnKind.Group -> createColumnGroup(name, (values as List).concat()).asDataColumn().cast() + ColumnKind.Frame -> createFrameColumn(name, values as List).asDataColumn().cast() + } + + public inline fun create(name: String, values: List, infer: Infer = Infer.None): DataColumn = + create(name, values, typeOf(), infer) + + public fun empty(name: String = ""): AnyCol = createValueColumn(name, emptyList(), typeOf()) + } + + public fun hasNulls(): Boolean = type().isMarkedNullable + + override fun distinct(): DataColumn + + override fun get(indices: Iterable): DataColumn + + override fun rename(newName: String): DataColumn + + override fun resolveSingle(context: ColumnResolutionContext): ColumnWithPath? = this.addPath() + + override operator fun getValue(thisRef: Any?, property: KProperty<*>): DataColumn = + super.getValue(thisRef, property) as DataColumn + + public operator fun iterator(): Iterator = values().iterator() + + public override operator fun get(range: IntRange): DataColumn +} + +public val AnyCol.name: String get() = name() +public val AnyCol.path: ColumnPath get() = path() + +public val DataColumn.values: Iterable get() = values() +public val AnyCol.hasNulls: Boolean get() = hasNulls() +public val AnyCol.size: Int get() = size() +public val AnyCol.indices: IntRange get() = indices() + +public val AnyCol.type: KType get() = type() +public val AnyCol.kind: ColumnKind get() = kind() +public val AnyCol.typeClass: KClass<*> + get() = type.classifier as? KClass<*> + ?: error("Cannot cast ${type.classifier?.javaClass} to a ${KClass::class}. Column $name: $type") + +public fun AnyBaseCol.indices(): IntRange = 0 until size() diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataFrame.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataFrame.kt new file mode 100644 index 000000000..c997fbffb --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataFrame.kt @@ -0,0 +1,135 @@ +package org.jetbrains.kotlinx.dataframe + +import org.jetbrains.kotlinx.dataframe.aggregation.Aggregatable +import org.jetbrains.kotlinx.dataframe.aggregation.AggregateGroupedBody +import org.jetbrains.kotlinx.dataframe.annotations.HasSchema +import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl +import org.jetbrains.kotlinx.dataframe.api.add +import org.jetbrains.kotlinx.dataframe.api.cast +import org.jetbrains.kotlinx.dataframe.api.getRows +import org.jetbrains.kotlinx.dataframe.api.indices +import org.jetbrains.kotlinx.dataframe.api.rows +import org.jetbrains.kotlinx.dataframe.api.select +import org.jetbrains.kotlinx.dataframe.api.toDataFrame +import org.jetbrains.kotlinx.dataframe.columns.UnresolvedColumnsPolicy +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.DataFrameImpl +import org.jetbrains.kotlinx.dataframe.impl.DataFrameSize +import org.jetbrains.kotlinx.dataframe.impl.getColumnsImpl +import org.jetbrains.kotlinx.dataframe.impl.headPlusArray +import org.jetbrains.kotlinx.dataframe.impl.headPlusIterable +import org.jetbrains.kotlinx.dataframe.impl.schema.createEmptyDataFrame +import org.jetbrains.kotlinx.dataframe.impl.schema.createEmptyDataFrameOf +import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema +import kotlin.reflect.KType + +/** + * Readonly interface for an ordered list of [columns][DataColumn]. + * + * Columns in `DataFrame` have distinct non-empty [names][DataColumn.name] and equal [sizes][DataColumn.size]. + * + * @param T Schema marker. It identifies column schema and is used to generate schema-specific extension properties for typed data access. It is covariant, so `DataFrame` is assignable to variable of type `DataFrame` if `A` is a subtype of `B`. + */ +@HasSchema(schemaArg = 0) +public interface DataFrame : + Aggregatable, + ColumnsContainer { + + public companion object { + public val Empty: AnyFrame = DataFrameImpl(emptyList(), 0) + + public fun empty(nrow: Int = 0): AnyFrame = if (nrow == 0) Empty else DataFrameImpl(emptyList(), nrow) + + /** + * Creates a DataFrame with empty columns (rows = 0). + * Can be used as a "null object" in aggregation operations, operations that work on columns (select, reorder, ...) + * + */ + public inline fun emptyOf(): DataFrame = createEmptyDataFrameOf(T::class).cast() + + /** + * Creates a DataFrame with empty columns (rows = 0). + * Can be used as a "null object" in aggregation operations, operations that work on columns (select, reorder, ...) + */ + public fun empty(schema: DataFrameSchema): AnyFrame = schema.createEmptyDataFrame() + } + + // region columns + + public fun columnNames(): List + + public fun columnTypes(): List + + // endregion + + // region rows + + public fun rowsCount(): Int + + public operator fun iterator(): Iterator> = rows().iterator() + + // endregion + + public fun aggregate(body: AggregateGroupedBody): DataRow + + // region get columns + + /** + * Returns a list of columns selected by [columns], a [ColumnsSelectionDsl]. + * + * NOTE: This doesn't work in [ColumnsSelectionDsl], use [ColumnsSelectionDsl.cols] to select columns by predicate. + */ + override fun get(columns: ColumnsSelector): List> = + getColumnsImpl(UnresolvedColumnsPolicy.Fail, columns) + + // endregion + + // region get rows + + public operator fun get(index: Int): DataRow + + public operator fun get(indices: Iterable): DataFrame = getRows(indices) + + public operator fun get(range: IntRange): DataFrame = getRows(range) + + public operator fun get(first: IntRange, vararg ranges: IntRange): DataFrame = + getRows(headPlusArray(first, ranges).asSequence().flatMap { it.asSequence() }.asIterable()) + + public operator fun get(firstIndex: Int, vararg otherIndices: Int): DataFrame = + get(headPlusIterable(firstIndex, otherIndices.asIterable())) + + // endregion + + // region plus columns + + public operator fun plus(col: AnyBaseCol): DataFrame = add(col) + + public operator fun plus(cols: Iterable): DataFrame = (columns() + cols).toDataFrame().cast() + + // endregion +} + +// region get columns + +/** + * Returns a list of columns selected by [columns], a [ColumnsSelectionDsl]. + */ +public operator fun DataFrame.get(columns: ColumnsSelector): List> = this.get(columns) + +public operator fun DataFrame.get(first: AnyColumnReference, vararg other: AnyColumnReference): DataFrame = + select { (listOf(first) + other).toColumnSet() } + +public operator fun DataFrame.get(first: String, vararg other: String): DataFrame = + select { (listOf(first) + other).toColumnSet() } + +public operator fun DataFrame.get(columnRange: ClosedRange): DataFrame = + select { columnRange.start..columnRange.endInclusive } + +// endregion + +internal val ColumnsContainer<*>.ncol get() = columnsCount() +internal val AnyFrame.nrow get() = rowsCount() +internal val AnyFrame.indices get() = indices() +internal val AnyFrame.size: DataFrameSize get() = size() + +public fun AnyFrame.size(): DataFrameSize = DataFrameSize(ncol, nrow) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataRow.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataRow.kt new file mode 100644 index 000000000..68399d748 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataRow.kt @@ -0,0 +1,147 @@ +package org.jetbrains.kotlinx.dataframe + +import org.jetbrains.kotlinx.dataframe.api.next +import org.jetbrains.kotlinx.dataframe.api.prev +import org.jetbrains.kotlinx.dataframe.columns.ColumnKind +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.owner +import org.jetbrains.kotlinx.dataframe.impl.toIterable +import kotlin.reflect.KProperty + +/** + * Single row of a [DataFrame]. + * + * @param T Schema marker. See [DataFrame] for details + */ +public interface DataRow { + + public fun index(): Int + + public fun df(): DataFrame + + // region get cell value + + public operator fun get(columnIndex: Int): Any? + + public operator fun get(expression: RowExpression): R = expression(this, this) + + public operator fun get(column: ColumnReference): R + + public operator fun get(columns: List>): List = columns.map { get(it) } + + public operator fun get(property: KProperty): R = get(property.columnName) as R + + public operator fun get(first: AnyColumnReference, vararg other: AnyColumnReference): DataRow = + owner.get(first, *other)[index] + + public operator fun get(first: String, vararg other: String): DataRow = owner.get(first, *other)[index] + + public operator fun get(path: ColumnPath): Any? = owner.get(path)[index] + + public operator fun get(name: String): Any? + + public fun getColumnGroup(columnName: String): AnyRow { + val value = get(columnName) + if (value == null) { + val kind = df()[columnName].kind() + if (kind != ColumnKind.Group) { + error("Cannot cast null value of a $kind to a ${DataRow::class}") + } + } + return value as AnyRow + } + + public fun getFrameColumn(columnName: String): AnyFrame { + val value = get(columnName) + if (value == null) { + val kind = df()[columnName].kind() + if (kind != ColumnKind.Frame) { + error("Cannot cast null value of a $kind to a ${DataFrame::class}") + } + } + return value as AnyFrame + } + + public fun getOrNull(name: String): Any? + + public fun getValueOrNull(column: ColumnReference): R? + + // endregion + + public fun values(): List + + public operator fun String.get(vararg path: String): ColumnPath = ColumnPath(listOf(this) + path) + + public operator fun ColumnReference.invoke(): R = get(this) + + public operator fun String.invoke(): R = this@DataRow[this@invoke] as R + + public operator fun ColumnPath.invoke(): R = this@DataRow.get(this) as R + + public fun forwardIterable(): Iterable> = this.toIterable { it.next } + + public fun backwardIterable(): Iterable> = this.toIterable { it.prev } + + public operator fun > ColumnReference.compareTo(other: R): Int = get(this).compareTo(other) + + public operator fun ColumnReference.plus(a: Int): Int = get(this) + a + + public operator fun ColumnReference.plus(a: Long): Long = get(this) + a + + public operator fun ColumnReference.plus(a: Double): Double = get(this) + a + + public operator fun ColumnReference.plus(a: String): String = get(this) + a + + public operator fun Int.plus(col: ColumnReference): Int = this + get(col) + + public operator fun Long.plus(col: ColumnReference): Long = this + get(col) + + public operator fun Double.plus(col: ColumnReference): Double = this + get(col) + + public operator fun ColumnReference.minus(a: Int): Int = get(this) - a + + public operator fun ColumnReference.minus(a: Long): Long = get(this) - a + + public operator fun ColumnReference.minus(a: Double): Double = get(this) - a + + public operator fun Int.minus(col: ColumnReference): Int = this - get(col) + + public operator fun Long.minus(col: ColumnReference): Long = this - get(col) + + public operator fun Double.minus(col: ColumnReference): Double = this - get(col) + + public operator fun ColumnReference.times(a: Int): Int = get(this) * a + + public operator fun ColumnReference.times(a: Long): Long = get(this) * a + + public operator fun ColumnReference.times(a: Double): Double = get(this) * a + + public operator fun ColumnReference.times(a: Int): Double = get(this) * a + + public operator fun ColumnReference.times(a: Int): Long = get(this) * a + + public operator fun ColumnReference.times(a: Long): Double = get(this) * a + + public operator fun ColumnReference.div(a: Int): Int = get(this) / a + + public operator fun ColumnReference.div(a: Long): Long = get(this) / a + + public operator fun ColumnReference.div(a: Double): Double = get(this) / a + + public operator fun ColumnReference.div(a: Int): Double = get(this) / a + + public operator fun ColumnReference.div(a: Int): Long = get(this) / a + + public operator fun ColumnReference.div(a: Long): Double = get(this) / a + + public companion object { + public val empty: AnyRow = DataFrame.empty(1)[0] + } +} + +internal val AnyRow.values: List get() = values() +internal val AnyRow.index: Int get() = index() +internal val DataRow.prev: DataRow? get() = this.prev() +internal val DataRow.next: DataRow? get() = this.next() diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/Aggregatable.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/Aggregatable.kt new file mode 100644 index 000000000..7cb74c05f --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/Aggregatable.kt @@ -0,0 +1,3 @@ +package org.jetbrains.kotlinx.dataframe.aggregation + +public interface Aggregatable diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/AggregateDsl.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/AggregateDsl.kt new file mode 100644 index 000000000..6bd7c2052 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/AggregateDsl.kt @@ -0,0 +1,35 @@ +package org.jetbrains.kotlinx.dataframe.aggregation + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.HasSchema +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.api.ColumnSelectionDsl +import org.jetbrains.kotlinx.dataframe.api.pathOf +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.impl.aggregation.ValueWithDefault +import org.jetbrains.kotlinx.dataframe.impl.aggregation.receivers.internal +import org.jetbrains.kotlinx.dataframe.impl.columnName +import kotlin.reflect.KProperty +import kotlin.reflect.typeOf + +@HasSchema(schemaArg = 0) +public abstract class AggregateDsl : + DataFrame, + ColumnSelectionDsl { + + @Interpretable("GroupByInto") + public inline infix fun R.into(name: String): NamedValue = + internal().yield(pathOf(name), this, typeOf()) + + public inline infix fun R.into(column: ColumnAccessor): NamedValue = + internal().yield(pathOf(column.name()), this, typeOf()) + + public inline infix fun R.into(column: KProperty): NamedValue = + internal().yield(pathOf(column.columnName), this, typeOf()) + + public infix fun R.default(defaultValue: R): Any = + when (this) { + is NamedValue -> this.also { it.default = defaultValue } + else -> ValueWithDefault(this, defaultValue) + } +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/AggregateGroupedDsl.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/AggregateGroupedDsl.kt new file mode 100644 index 000000000..43b529522 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/AggregateGroupedDsl.kt @@ -0,0 +1,3 @@ +package org.jetbrains.kotlinx.dataframe.aggregation + +public abstract class AggregateGroupedDsl : AggregateDsl() diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/ColumnsForAggregateSelectionDsl.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/ColumnsForAggregateSelectionDsl.kt new file mode 100644 index 000000000..f3d91b35f --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/ColumnsForAggregateSelectionDsl.kt @@ -0,0 +1,31 @@ +package org.jetbrains.kotlinx.dataframe.aggregation + +import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl +import org.jetbrains.kotlinx.dataframe.api.pathOf +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.impl.aggregation.ConfiguredAggregateColumn + +public interface ColumnsForAggregateSelectionDsl : ColumnsSelectionDsl { + + public infix fun ColumnSet.default(defaultValue: C): ColumnSet = + ConfiguredAggregateColumn.withDefault(this, defaultValue) + + public infix fun SingleColumn.default(defaultValue: C): SingleColumn = + ConfiguredAggregateColumn.withDefault(this, defaultValue) + + public fun path(vararg names: String): ColumnPath = ColumnPath(names.asList()) + + public infix fun ColumnSet.into(name: String): ColumnSet = + ConfiguredAggregateColumn.withPath(this, pathOf(name)) + + public infix fun SingleColumn.into(name: String): SingleColumn = + ConfiguredAggregateColumn.withPath(this, pathOf(name)) + + public infix fun ColumnSet.into(path: ColumnPath): ColumnSet = + ConfiguredAggregateColumn.withPath(this, path) + + public infix fun SingleColumn.into(path: ColumnPath): SingleColumn = + ConfiguredAggregateColumn.withPath(this, path) +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/NamedValue.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/NamedValue.kt new file mode 100644 index 000000000..0a709ed44 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/NamedValue.kt @@ -0,0 +1,34 @@ +package org.jetbrains.kotlinx.dataframe.aggregation + +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.impl.aggregation.ValueWithDefault +import org.jetbrains.kotlinx.dataframe.impl.emptyPath +import kotlin.reflect.KType + +@Suppress("DataClassPrivateConstructor") +public data class NamedValue private constructor( + val path: ColumnPath, + val value: Any?, + val type: KType?, + var default: Any?, + val guessType: Boolean = false, +) { + public companion object { + internal fun create( + path: ColumnPath, + value: Any?, + type: KType?, + defaultValue: Any?, + guessType: Boolean = false, + ): NamedValue = + when (value) { + is ValueWithDefault<*> -> create(path, value.value, type, value.default, guessType) + else -> NamedValue(path, value, type, defaultValue, guessType) + } + + internal fun aggregator(builder: AggregateGroupedDsl<*>): NamedValue = + NamedValue(emptyPath(), builder, null, null, false) + } + + val name: String get() = path.last() +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/aliases.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/aliases.kt new file mode 100644 index 000000000..cbc5e4146 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aggregation/aliases.kt @@ -0,0 +1,10 @@ +package org.jetbrains.kotlinx.dataframe.aggregation + +import org.jetbrains.kotlinx.dataframe.Selector +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver + +public typealias AggregateBody = Selector, R> + +public typealias AggregateGroupedBody = Selector, R> + +public typealias ColumnsForAggregateSelector = Selector, ColumnsResolver> diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aliases.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aliases.kt new file mode 100644 index 000000000..4f1335a9b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aliases.kt @@ -0,0 +1,211 @@ +package org.jetbrains.kotlinx.dataframe + +import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl +import org.jetbrains.kotlinx.dataframe.columns.BaseColumn +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn + +/** + * ## Predicate + * + * [Predicate] is a lambda function expecting a [Boolean] result given an instance of `T` as `it`. + * + * Shorthand for: + * ```kotlin + * (it: T) -> Boolean + * ``` + */ +public typealias Predicate = (it: T) -> Boolean + +/** + * ## Selector + * + * [Selector] is a lambda function expecting an `R` result given an instance of `T` as context (`this` and `it`). + * + * Shorthand for: + * ```kotlin + * T.(it: T) -> R + * ``` + */ +public typealias Selector = T.(it: T) -> R + +// region selectors + +/** + * ## DataFrame Expression + * + * [DataFrameExpression] is a lambda function expecting an `R` result given an instance of [DataFrame]`` as context + * (`this` and `it`). + * `R` can be selected or expressed. + * + * Shorthand for: + * ```kotlin + * DataFrame.(it: DataFrame) -> R + * ``` + */ +public typealias DataFrameExpression = Selector, R> + +/** + * ## Row Expression + * + * [RowExpression] is a lambda function expecting an `R` result given an instance of [DataRow]`` as context + * (`this` and `it`). `R` can be selected or expressed. + * + * Shorthand for: + * ```kotlin + * DataRow.(it: DataRow) -> R + * ``` + */ +public typealias RowExpression = Selector, R> + +/** + * ## Row Value Expression + * + * [RowValueExpression] is a lambda function expecting an `R` result given the value `it: C` and an + * instance of [DataRow]`` as context (`this`). `R` can be selected or expressed. + * + * Shorthand for: + * ```kotlin + * DataRow.(it: C) -> R + * ``` + */ +public typealias RowValueExpression = DataRow.(it: C) -> R + +/** + * ## Row Column Expression + * + * [RowColumnExpression] is a lambda function expecting an `R` result given an instance of [DataRow]`` as + * `row` and [DataColumn]`` as `col`. `R` can be selected or expressed. + * + * Shorthand for: + * ```kotlin + * (row: DataRow, col: DataColumn) -> R + * ``` + */ +public typealias RowColumnExpression = (row: DataRow, col: DataColumn) -> R + +/** + * ## Column Expression + * + * [ColumnExpression] is a lambda function expecting an `R` result given an instance of [DataColumn]`` as context + * (`this` and `it`). `R` can be selected or expressed. + * + * Shorthand for: + * ```kotlin + * DataColumn.(it: DataColumn) -> R + * ``` + */ +public typealias ColumnExpression = Selector, R> + +/** + * ## Column Selector + * + * [ColumnSelector] is a lambda function expecting a [SingleColumn]<`C`> result given an instance of [ColumnsSelectionDsl]`` + * as context (`this` and `it`). [SingleColumn]`` can be selected or expressed. + * + * See [Columns Selection DSL][ColumnsSelectionDsl] for more information. + * + * Shorthand for: + * ```kotlin + * ColumnsSelectionDsl.(it: ColumnsSelectionDsl) -> SingleColumn + * ``` + */ +public typealias ColumnSelector = Selector, SingleColumn> + +/** + * ## Columns Selector + * + * [ColumnsSelector] is a lambda function expecting a [ColumnsResolver]<`C`> ([SingleColumn]<`C`> or [ColumnSet]<`C`>) + * result given an instance of [ColumnsSelectionDsl]`` as context (`this` and `it`). + * [ColumnsResolver]<`C`> can be selected or expressed. + * + * See [Columns Selection DSL][ColumnsSelectionDsl] for more information. + * + * Shorthand for: + * ```kotlin + * ColumnsSelectionDsl.(it: ColumnsSelectionDsl) -> ColumnsResolver + * ``` + */ +public typealias ColumnsSelector = Selector, ColumnsResolver> + +// endregion + +// region filters + +/** + * ## Row Filter + * + * [RowFilter] is a lambda function expecting a [Boolean] result given an instance of [DataRow]`` as context + * (`this` and `it`). + * + * Return `true` if the row should be included in the result. + * + * Shorthand for: + * ```kotlin + * DataRow.(it: DataRow) -> Boolean + * ``` + */ +public typealias RowFilter = RowExpression + +/** + * ## Column Filter + * + * [ColumnFilter] is a lambda function expecting a [Boolean] result given an instance of [DataColumn]`` as context + * (`this` and `it`). + * + * Return `true` if the column should be included in the result. + * + * Shorthand for: + * ```kotlin + * (it: ColumnWithPath) -> Boolean + * ``` + */ +public typealias ColumnFilter = Predicate> + +/** + * ## Row Value Filter + * + * [RowValueFilter] is a lambda function expecting a [Boolean] result given the value `it: C` and an instance + * of [DataRow]`` as context (`this`). + * + * Return `true` if the row should be included in the result. + * + * Shorthand for: + * ```kotlin + * DataRow.(it: C) -> Boolean + * ``` + */ +public typealias RowValueFilter = RowValueExpression + +// endregion + +// region columns + +public typealias AnyColumnReference = ColumnReference<*> + +public typealias ColumnGroupReference = ColumnReference +public typealias ColumnGroupAccessor = ColumnAccessor> +public typealias AnyColumnGroupAccessor = ColumnGroupAccessor<*> + +public typealias DoubleCol = DataColumn +public typealias BooleanCol = DataColumn +public typealias IntCol = DataColumn +public typealias NumberCol = DataColumn +public typealias StringCol = DataColumn +public typealias AnyCol = DataColumn<*> + +// endregion + +// region Any* + +public typealias AnyFrame = DataFrame<*> + +public typealias AnyRow = DataRow<*> + +public typealias AnyBaseCol = BaseColumn<*> + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/ColumnName.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/ColumnName.kt new file mode 100644 index 000000000..11ea05df3 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/ColumnName.kt @@ -0,0 +1,4 @@ +package org.jetbrains.kotlinx.dataframe.annotations + +@Target(AnnotationTarget.PROPERTY) +public annotation class ColumnName(val name: String) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/DataSchema.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/DataSchema.kt new file mode 100644 index 000000000..2422c1d33 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/DataSchema.kt @@ -0,0 +1,4 @@ +package org.jetbrains.kotlinx.dataframe.annotations + +@Target(AnnotationTarget.CLASS) +public annotation class DataSchema(val isOpen: Boolean = true) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/ImportDataSchema.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/ImportDataSchema.kt new file mode 100644 index 000000000..00f99ac5d --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/ImportDataSchema.kt @@ -0,0 +1,82 @@ +package org.jetbrains.kotlinx.dataframe.annotations + +import org.jetbrains.kotlinx.dataframe.api.JsonPath +import org.jetbrains.kotlinx.dataframe.api.KeyValueProperty +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.io.JSON + +/** + * Annotation preprocessing will generate a DataSchema interface from the data at `path`. + * Data must be of supported format: CSV, JSON, Apache Arrow, Excel, OpenAPI (Swagger) in YAML/JSON, JDBC. + * Generated data schema has properties inferred from data and a companion object with `read method`. + * `read method` is either `readCSV` or `readJson` that returns `DataFrame` + * + * @param name name of the generated interface + * @param path URL or relative path to data. + * If a path starts with protocol (http, https, ftp, jdbc), it's considered a URL. + * Otherwise, it's treated as a relative path. + * By default, it will be resolved relatively to project dir, i.e. File(projectDir, path) + * You can configure it by passing `dataframe.resolutionDir` option to preprocessor, + * see https://kotlinlang.org/docs/ksp-quickstart.html#pass-options-to-processors + * @param visibility visibility of the generated interface. + * @param normalizationDelimiters if not empty, split property names by delimiters, + * lowercase parts and join to camel case. Set empty list to disable normalization + * @param withDefaultPath if `true`, generate `defaultPath` property to the data schema's companion object and make it default argument for a `read method` + * @param csvOptions options to parse CSV data. Not used when data is not Csv + * @param jsonOptions options to parse JSON data. Not used when data is not Json + * @param jdbcOptions options to parse data from a database via JDBC. Not used when data is not stored in the database + */ +@Retention(AnnotationRetention.SOURCE) +@Target(AnnotationTarget.FILE) +@Repeatable +public annotation class ImportDataSchema( + val name: String, + val path: String, + val visibility: DataSchemaVisibility = DataSchemaVisibility.IMPLICIT_PUBLIC, + val normalizationDelimiters: CharArray = ['\t', ' ', '_'], + val withDefaultPath: Boolean = true, + val csvOptions: CsvOptions = CsvOptions(','), + val jsonOptions: JsonOptions = JsonOptions(), + val jdbcOptions: JdbcOptions = JdbcOptions(), +) + +public enum class DataSchemaVisibility { + INTERNAL, + IMPLICIT_PUBLIC, + EXPLICIT_PUBLIC, +} + +public annotation class CsvOptions(public val delimiter: Char) + +/** + * An annotation class that represents options for JDBC connection. + * + * @property [user] The username for the JDBC connection. Default value is an empty string. + * If [extractCredFromEnv] is true, the [user] value will be interpreted as key for system environment variable. + * @property [password] The password for the JDBC connection. Default value is an empty string. + * If [extractCredFromEnv] is true, the [password] value will be interpreted as key for system environment variable. + * @property [extractCredFromEnv] Whether to extract the JDBC credentials from environment variables. Default value is false. + * @property [tableName] The name of the table for the JDBC connection. Default value is an empty string. + * @property [sqlQuery] The SQL query to be executed in the JDBC connection. Default value is an empty string. + */ +public annotation class JdbcOptions( + public val user: String = "", + public val password: String = "", + public val extractCredFromEnv: Boolean = false, + public val tableName: String = "", + public val sqlQuery: String = "", +) + +public annotation class JsonOptions( + /** Allows the choice of how to handle type clashes when reading a JSON file. */ + public val typeClashTactic: JSON.TypeClashTactic = JSON.TypeClashTactic.ARRAY_AND_VALUE_COLUMNS, + /** + * List of [JsonPath]s where instead of a [ColumnGroup], a [FrameColumn]<[KeyValueProperty]> + * will be created. + * + * Example: + * `["""$["store"]["book"][*]["author"]"""]` + */ + public val keyValuePaths: Array = [], +) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/Plugin.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/Plugin.kt new file mode 100644 index 000000000..0493f6254 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/annotations/Plugin.kt @@ -0,0 +1,45 @@ +package org.jetbrains.kotlinx.dataframe.annotations + +@Target(AnnotationTarget.CLASS) +public annotation class HasSchema(val schemaArg: Int) + +/** + * Compiler plugin will evaluate compile time value of the annotated function. + * Needed because some function calls only serve as a part of overall compile time DataSchema evaluation + * There's no need to update return type of such calls + */ +public annotation class Interpretable(val interpreter: String) + +/** + * Compiler plugin will replace return type of calls to the annotated function + */ +public annotation class Refine + +internal annotation class OptInRefine + +@Retention(AnnotationRetention.SOURCE) +@Target(AnnotationTarget.FILE, AnnotationTarget.EXPRESSION) +public annotation class DisableInterpretation + +@Retention(AnnotationRetention.SOURCE) +@Target(AnnotationTarget.EXPRESSION) +public annotation class Import + +@Target(AnnotationTarget.PROPERTY) +public annotation class Order(val order: Int) + +/** + * For internal use + * Compiler plugin materializes schemas as classes. + * These classes have two kinds of properties: + * 1. Scope properties that only serve as a reference for internal property resolution + * 2. Schema properties that reflect dataframe structure + * Scope properties need + * to be excluded in IDE plugin and in [org.jetbrains.kotlinx.dataframe.codeGen.MarkersExtractor.get] + * This annotation serves to distinguish between the two where needed + */ +@Target(AnnotationTarget.PROPERTY) +public annotation class ScopeProperty + +@Target(AnnotationTarget.FUNCTION) +internal annotation class Check diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnAccessorApi.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnAccessorApi.kt new file mode 100644 index 000000000..834fbdd5f --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnAccessorApi.kt @@ -0,0 +1,5 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor + +public inline fun ColumnAccessor.nullable(): ColumnAccessor = cast() diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnReferenceApi.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnReferenceApi.kt new file mode 100644 index 000000000..40c90f36d --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnReferenceApi.kt @@ -0,0 +1,29 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ValueColumn +import org.jetbrains.kotlinx.dataframe.impl.asList +import kotlin.reflect.typeOf + +internal val ColumnReference<*>.name: String get() = name() + +public inline fun ColumnReference.withValues(vararg values: T): ValueColumn = + withValues(values.asIterable()) + +public inline fun ColumnReference.withValues(values: Iterable): ValueColumn = + DataColumn.createValueColumn(name(), values.asList(), typeOf()) + +public infix fun > ColumnReference.gt(value: C): ColumnReference = map { it > value } + +public infix fun > ColumnReference.lt(value: C): ColumnReference = map { it < value } + +public infix fun ColumnReference.eq(value: C): ColumnReference = map { it == value } + +public infix fun ColumnReference.neq(value: C): ColumnReference = map { it != value } + +public fun ColumnReference.length(): ColumnReference = map { it?.length ?: 0 } + +public fun ColumnReference.lowercase(): ColumnReference = map { it?.lowercase() } + +public fun ColumnReference.uppercase(): ColumnReference = map { it?.uppercase() } diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnSelectionDsl.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnSelectionDsl.kt new file mode 100644 index 000000000..24da6d8c9 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnSelectionDsl.kt @@ -0,0 +1,274 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsContainer +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.getColumn +import kotlin.reflect.KProperty + +/** [Column Selection DSL][ColumnSelectionDsl] */ +internal interface ColumnSelectionDslLink + +public interface ColumnSelectionDsl : ColumnsContainer { + + /** + * Retrieves the value of this [ColumnReference] or [-Accessor][ColumnAccessor] from + * the [DataFrame]. + * + * This is a shorthand for [get][ColumnsContainer.get]`(myColumn)`. + * @throws [IllegalArgumentException] if the column is not found. + */ + private interface CommonColumnReferenceInvokeDocs + + /** + * Retrieves the value of this [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] or [-Accessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] from + * the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(myColumn)`. + * @throws [IllegalArgumentException] if the column is not found. + * @return The [DataColumn] this [Column Reference][ColumnReference] or [-Accessor][ColumnAccessor] points to. + */ + public operator fun ColumnReference.invoke(): DataColumn = get(this) + + /** + * Retrieves the value of this [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] or [-Accessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] from + * the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(myColumn)`. + * @throws [IllegalArgumentException] if the column is not found. + * @return The [ColumnGroup] this [Column Reference][ColumnReference] or [-Accessor][ColumnAccessor] points to. + */ + public operator fun ColumnReference>.invoke(): ColumnGroup = get(this) + + /** + * Retrieves the value of this [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] or [-Accessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] from + * the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(myColumn)`. + * @throws [IllegalArgumentException] if the column is not found. + * @return The [FrameColumn] this [Column Reference][ColumnReference] or [-Accessor][ColumnAccessor] points to. + */ + public operator fun ColumnReference>.invoke(): FrameColumn = get(this) + + /** + * Retrieves the value of this [ColumnPath] from the [DataFrame]. + * This is a shorthand for [getColumn][ColumnsContainer.getColumn]`(myColumnPath)` and + * is most often used in combination with `operator fun String.get(column: String)`, + * for instance: + * ```kotlin + * "myColumn"["myNestedColumn"]() + * ``` + * + * @throws [IllegalArgumentException] if the column is not found. + * @return The [DataColumn] this [ColumnPath] points to. + */ + public operator fun ColumnPath.invoke(): DataColumn = getColumn(this).cast() + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame]. + * + * This is a shorthand for [get][ColumnsContainer.get]`(MyType::myColumn)`. + * @throws [IllegalArgumentException] if the column is not found. + */ + private interface CommonKPropertyInvokeDocs + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyType::myColumn)`. + * @throws [IllegalArgumentException] if the column is not found. + * @return The [DataColumn] this [KProperty Accessor][KProperty] points to. + */ + public operator fun KProperty.invoke(): DataColumn = this@ColumnSelectionDsl[this] + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyType::myColumn)`. + * @throws [IllegalArgumentException] if the column is not found. + * @return The [ColumnGroup] this [KProperty Accessor][KProperty] points to. + */ + public operator fun KProperty>.invoke(): ColumnGroup = this@ColumnSelectionDsl[this] + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyType::myColumn)`. + * @throws [IllegalArgumentException] if the column is not found. + * @return The [FrameColumn] this [KProperty Accessor][KProperty] points to. + */ + public operator fun KProperty>.invoke(): FrameColumn = this@ColumnSelectionDsl[this] + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame]. + * + * This is a shorthand for + * + * [get][ColumnsContainer.get]`(MyType::myColumnGroup).`[asColumnGroup][asColumnGroup]`().`[get][ColumnsContainer.get]`(MyOtherType::myOtherColumn)` + * + * and can instead be written as + * + * `MyType::myColumnGroup`[`[`][KProperty.get]`MyOtherType::myOtherColumn`[`]`][KProperty.get]. + * + * @throws [IllegalArgumentException] if the column is not found. + */ + private interface CommonKPropertyGetDocs + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for + * + * [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyType::myColumnGroup).`[asColumnGroup][org.jetbrains.kotlinx.dataframe.api.asColumnGroup]`().`[get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyOtherType::myOtherColumn)` + * + * and can instead be written as + * + * `MyType::myColumnGroup`[`[`][kotlin.reflect.KProperty.get]`MyOtherType::myOtherColumn`[`]`][kotlin.reflect.KProperty.get]. + * + * @throws [IllegalArgumentException] if the column is not found. + * @return The [DataColumn] these [KProperty Accessors][KProperty] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("KPropertyDataRowGet") + public operator fun KProperty>.get(column: KProperty): DataColumn = invoke()[column] + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for + * + * [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyType::myColumnGroup).`[asColumnGroup][org.jetbrains.kotlinx.dataframe.api.asColumnGroup]`().`[get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyOtherType::myOtherColumn)` + * + * and can instead be written as + * + * `MyType::myColumnGroup`[`[`][kotlin.reflect.KProperty.get]`MyOtherType::myOtherColumn`[`]`][kotlin.reflect.KProperty.get]. + * + * @throws [IllegalArgumentException] if the column is not found. + * @return The [ColumnGroup] these [KProperty Accessors][KProperty] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("KPropertyDataRowGet") + public operator fun KProperty>.get(column: KProperty>): ColumnGroup = + invoke()[column] + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for + * + * [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyType::myColumnGroup).`[asColumnGroup][org.jetbrains.kotlinx.dataframe.api.asColumnGroup]`().`[get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyOtherType::myOtherColumn)` + * + * and can instead be written as + * + * `MyType::myColumnGroup`[`[`][kotlin.reflect.KProperty.get]`MyOtherType::myOtherColumn`[`]`][kotlin.reflect.KProperty.get]. + * + * @throws [IllegalArgumentException] if the column is not found. + * @return The [FrameColumn] these [KProperty Accessors][KProperty] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("KPropertyDataRowGet") + public operator fun KProperty>.get(column: KProperty>): FrameColumn = + invoke()[column] + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for + * + * [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyType::myColumnGroup).`[asColumnGroup][org.jetbrains.kotlinx.dataframe.api.asColumnGroup]`().`[get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyOtherType::myOtherColumn)` + * + * and can instead be written as + * + * `MyType::myColumnGroup`[`[`][kotlin.reflect.KProperty.get]`MyOtherType::myOtherColumn`[`]`][kotlin.reflect.KProperty.get]. + * + * @throws [IllegalArgumentException] if the column is not found. + * @return The [DataColumn] these [KProperty Accessors][KProperty] point to. + */ + public operator fun KProperty.get(column: KProperty): DataColumn = invoke().asColumnGroup()[column] + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for + * + * [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyType::myColumnGroup).`[asColumnGroup][org.jetbrains.kotlinx.dataframe.api.asColumnGroup]`().`[get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyOtherType::myOtherColumn)` + * + * and can instead be written as + * + * `MyType::myColumnGroup`[`[`][kotlin.reflect.KProperty.get]`MyOtherType::myOtherColumn`[`]`][kotlin.reflect.KProperty.get]. + * + * @throws [IllegalArgumentException] if the column is not found. + * @return The [ColumnGroup] these [KProperty Accessors][KProperty] point to. + */ + public operator fun KProperty.get(column: KProperty>): ColumnGroup = + invoke().asColumnGroup()[column] + + /** + * Retrieves the value of this [KProperty Accessor][KProperty] from the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame]. + * + * This is a shorthand for + * + * [get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyType::myColumnGroup).`[asColumnGroup][org.jetbrains.kotlinx.dataframe.api.asColumnGroup]`().`[get][org.jetbrains.kotlinx.dataframe.ColumnsContainer.get]`(MyOtherType::myOtherColumn)` + * + * and can instead be written as + * + * `MyType::myColumnGroup`[`[`][kotlin.reflect.KProperty.get]`MyOtherType::myOtherColumn`[`]`][kotlin.reflect.KProperty.get]. + * + * @throws [IllegalArgumentException] if the column is not found. + * @return The [FrameColumn] these [KProperty Accessors][KProperty] point to. + */ + public operator fun KProperty.get(column: KProperty>): FrameColumn = + invoke().asColumnGroup()[column] + + /** + * Retrieves the value of the column with this name from the [DataFrame]. This can be + * both typed and untyped. + * This is a shorthand for [get][ColumnsContainer.get]`("myColumnName")` and can be + * written as `"myColumnName"()` instead. + * + * @throws [IllegalArgumentException] if there is no column with this name. + * @return The [DataColumn] with this name. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("stringInvokeTyped") + public operator fun String.invoke(): DataColumn = getColumn(this).cast() + + /** + * Retrieves the value of the column with this name from the [DataFrame]. This can be + * both typed and untyped. + * This is a shorthand for [get][ColumnsContainer.get]`("myColumnName")` and can be + * written as `"myColumnName"()` instead. + * + * @throws [IllegalArgumentException] if there is no column with this name. + * @return The [DataColumn] with this name. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("stringInvokeUntyped") + public operator fun String.invoke(): DataColumn<*> = getColumn(this) + + /** + * Creates a [ColumnPath] from the receiver and the given column name [column]. + * This is a shorthand for [pathOf]`("myColumnName", "myNestedColumnName")` and is often used + * in combination with [ColumnPath.invoke] to retrieve the value of a nested column. + * For instance: + * ```kotlin + * "myColumn"["myNestedColumn"]() + * + * "myColumn"["myNestedColumn"]["myDoublyNestedColumn"]() + * ``` + */ + public operator fun String.get(column: String): ColumnPath = pathOf(this, column) + + /** + * As extension to `"myColumn"["myNestedColumn"]`, this function enables + * `"myColumn"["myNestedColumn"]["myDoublyNestedColumn"]` as alternative to + * [pathOf]`("myColumn", "myNestedColumn", "myDoublyNestedColumn")` + */ + public operator fun ColumnPath.get(column: String): ColumnPath = this + column +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt new file mode 100644 index 000000000..e78918dd1 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt @@ -0,0 +1,584 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import kotlin.reflect.KProperty + +/** [Columns Selection DSL][ColumnsSelectionDsl] */ +internal interface ColumnsSelectionDslLink + +@Suppress("UNCHECKED_CAST") +@PublishedApi +internal fun ColumnsSelectionDsl.asSingleColumn(): SingleColumn> = this as SingleColumn> + +/** + * [DslMarker] for [ColumnsSelectionDsl] to prevent accessors being used across scopes for nested + * [ColumnsSelectionDsl.select] calls. + */ +@DslMarker +@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPEALIAS, AnnotationTarget.TYPE, AnnotationTarget.FUNCTION) +public annotation class ColumnsSelectionDslMarker + +/** + * ## Columns Selection DSL + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[select][DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[select][DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * + * + */ +@ColumnsSelectionDslMarker +public interface ColumnsSelectionDsl : // SingleColumn> + ColumnSelectionDsl, + // first {}, firstCol() + FirstColumnsSelectionDsl, + // last {}, lastCol() + LastColumnsSelectionDsl, + // single {}, singleCol() + SingleColumnsSelectionDsl, + // col(name), col(5), [5] + ColColumnsSelectionDsl, + // valueCol(name), valueCol(5) + ValueColColumnsSelectionDsl, + // frameCol(name), frameCol(5) + FrameColColumnsSelectionDsl, + // colGroup(name), colGroup(5) + ColGroupColumnsSelectionDsl, + // cols {}, cols(), cols(colA, colB), cols(1, 5), cols(1..5), [{}] + ColsColumnsSelectionDsl, + // colA.."colB" + ColumnRangeColumnsSelectionDsl, + // valueCols {}, valueCols() + ValueColsColumnsSelectionDsl, + // frameCols {}, frameCols() + FrameColsColumnsSelectionDsl, + // colGroups {}, colGroups() + ColGroupsColumnsSelectionDsl, + // colsOfKind(Value, Frame) {}, colsOfKind(Value, Frame) + ColsOfKindColumnsSelectionDsl, + // all(Cols), allAfter(colA), allBefore(colA), allFrom(colA), allUpTo(colA) + AllColumnsSelectionDsl, + // colsAtAnyDepth {}, colsAtAnyDepth() + ColsAtAnyDepthColumnsSelectionDsl, + // colsInGroups {}, colsInGroups() + ColsInGroupsColumnsSelectionDsl, + // take(5), takeLastCols(2), takeLastWhile {}, takeColsWhile {} + TakeColumnsSelectionDsl, + // drop(5), dropLastCols(2), dropLastWhile {}, dropColsWhile {} + DropColumnsSelectionDsl, + // select {}, TODO due to String.invoke conflict this cannot be moved out of ColumnsSelectionDsl + SelectColumnsSelectionDsl, + // except(), allExcept {}, allColsExcept {} + AllExceptColumnsSelectionDsl, + // nameContains(""), colsNameContains(""), nameStartsWith(""), colsNameEndsWith("") + ColumnNameFiltersColumnsSelectionDsl, + // withoutNulls(), colsWithoutNulls() + WithoutNullsColumnsSelectionDsl, + // distinct() + DistinctColumnsSelectionDsl, + // none() + NoneColumnsSelectionDsl, + // colsOf<>(), colsOf<> {} + ColsOfColumnsSelectionDsl, + // simplify() + SimplifyColumnsSelectionDsl, + // filter {} + FilterColumnsSelectionDsl, + // colSet and colB + AndColumnsSelectionDsl, + // colA named "colB", colA into "colB" + RenameColumnsSelectionDsl, + // expr {} + ExprColumnsSelectionDsl { + + /** + * ## [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnGroupReference: `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + * `colSelector: `[`ColumnSelector`][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * + * `colsSelector: `[`ColumnsSelector`][org.jetbrains.kotlinx.dataframe.ColumnsSelector] + * + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + * `columnNoAccessor: `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + * `columnOrSet: `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + * `columnsResolver: `[`ColumnsResolver`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + * `expression: `[Column Expression][org.jetbrains.kotlinx.dataframe.documentation.ColumnExpression] + * + * `ignoreCase: `[`Boolean`][Boolean] + * + * `index: `[`Int`][Int] + * + * `indexRange: `[`IntRange`][IntRange] + * + * `infer: `[`Infer`][org.jetbrains.kotlinx.dataframe.api.Infer] + * + * `kind: `[`ColumnKind`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] + * + * `kType: `[`KType`][kotlin.reflect.KType] + * + * `name: `[`String`][String] + * + * `number: `[`Int`][Int] + * + * `regex: `[`Regex`][Regex] + * + * `singleColumn: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>>` + * + * `T: Column type` + * + * `text: `[`String`][String] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` `[**`..`**][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.rangeTo]` `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef] + * + * `| `**`this`**`/`**`it`**[**`[`**][cols][`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` .. `[**`]`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] + * + * `| `**`this`**`/`**`it`**[**`[`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**[**`]`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] + * + * `| `[**`all`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]**`()`** + * + * `| `**`all`**`(`[**`Before`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`|`[**`After`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`|`[**`From`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`|`[**`UpTo`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`) ( `**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`)`**` | `**`{ `**[`colSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSelectorDef]**` }`**` )` + * + * `| `[**`allExcept`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]**` { `**[`colsSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsSelectorDef]**` }`** + * + * `| `[**`allExcept`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` ..`**`)`** + * + * `| `[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]` `[**`and`**][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` [ `**`{`**` ] `[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]` [ `**`}`**` ] ` + * + * `| `[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]__`.`__[**`and`**][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]**` (`**`|`**`{ `**[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]**` }`**`|`**`)`** + * + * `| (`[**`col`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]`| `[**`valueCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]`| `[**`frameCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]`| `[**`colGroup`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`)[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + * `| (`[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`| `[**`valueCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`| `[**`frameCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`| `[**`colGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`) [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * `| `[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` .. | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`,`**` .. | `[`indexRange`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexRangeDef]**`)`** + * + * `| `[**`colsAtAnyDepth`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * `| `[**`colsInGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * `| `[**colsOf**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**` [ `**`(`**[`kType`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.KTypeDef]**`)`**` ] [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * `| `[**`colsOfKind`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]**`(`**[`kind`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnKindDef]**`,`**` ..`**`)`**` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * `| `[**`drop`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.drop]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.dropLast]`)`**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + * `| `[**`drop`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.dropWhile]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.dropLastWhile]`)`[**`While`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.dropWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + * `| `[**`expr`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]**`(`**`[`[`name`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NameDef]**`,`**`][`[`infer`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.InferDef]`]`**`) { `**[`expression`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnExpressionDef]**` }`** + * + * `| (`[**`first`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]`| `[**`last`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.last]`| `[**`single`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single]`) [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * `| `[**`nameContains`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameContains]**`(`**[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`] | `[`regex`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.RegexDef]**`)`** + * + * `| `__`name`__`(`[**`Starts`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameStartsWith]`|`[**`Ends`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameEndsWith]`)`**`With`**__`(`__[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`]`**`)`** + * + * `| `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` `[**named**][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.named]`/`[**into**][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.into]` `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef] + * + * `| `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]`(`__`.`__[**named**][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.named]`|`__`.`__[**into**][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.into]`)`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`)`** + * + * `| `[**`none`**][org.jetbrains.kotlinx.dataframe.api.NoneColumnsSelectionDsl.none]**`()`** + * + * `| `[**`take`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.take]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.takeLast]`)`**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + * `| `[**`take`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.takeWhile]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.takeLastWhile]`)`[**`While`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.takeWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + * `| `[**`withoutNulls`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.withoutNulls]**`()`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     [**`[`**][ColumnsSelectionDsl.col][`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef][**`]`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col] + * + *     `| `[**`[`**][cols][`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`,`**` .. | `[`indexRange`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexRangeDef][**`]`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] + * + *     `| `[**`[`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**[**`]`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] + * + *     `| `__`.`__[**`all`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]**`()`** + * + *     `| `**`.all`**`(`[**`Before`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`|`[**`After`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`|`[**`From`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`|`[**`UpTo`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`) ( `**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`)`**` | `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` )` + * + *     `| `__`.`__[**`and`**][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]**` (`**`|`**`{ `**[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]**` }`**`|`**`)`** + * + *     `| (`__`.`__[**`col`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]`| `__`.`__[**`valueCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]`| `__`.`__[**`frameCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]`| `__`.`__[**`colGroup`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`)`**`(`**[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + *     `| (`__`.`__[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`| `__`.`__[**`valueCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`| `__`.`__[**`frameCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`| `__`.`__[**`colGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`) [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.`__[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]**`(`**[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`,`**` .. | `[`indexRange`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexRangeDef]**`)`** + * + *     `| `__`.`__[**`colsAtAnyDepth`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.`__[**`colsInGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.`__[**`colsOf`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**` [ `**`(`**[`kType`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.KTypeDef]**`)`**` ] [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.`__[**`colsOfKind`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]**`(`**[`kind`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnKindDef]**`,`**` ..`**`)`**` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.`__[**`distinct`**][org.jetbrains.kotlinx.dataframe.api.DistinctColumnsSelectionDsl.distinct]**`()`** + * + *     `| `__`.`__[**`drop`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.drop]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.dropLast]`)`**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + *     `| `__`.`__[**`drop`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.dropWhile]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.dropLastWhile]`)`[**`While`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.dropWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + *     `| `[**`except`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` [`**` { `**`] `[`columnsResolver`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsResolverDef]` [`**` } `**`]` + * + *     `| `[**`except`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef] + * + *     `| `**`.`**[**`except`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` ..`**`)`** + * + *     `| `__`.`__[**`filter`**][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + *     `| (`__`.`__[**`first`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]`| `__`.`__[**`last`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.last]`| `__`.`__[**`single`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single]`) [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.name`__`(`[**`Starts`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameStartsWith]`|`[**`Ends`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameEndsWith]`)`**`With`**__`(`__[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`]`**`)`** + * + *     `| `__`.`__[**`nameContains`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameContains]**`(`**[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`] | `[`regex`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.RegexDef]**`)`** + * + *     `| `__`.`__[**`simplify`**][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify]**`()`** + * + *     `| `__`.`__[**`take`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.take]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.takeLast]`)`**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + *     `| `__`.`__[**`take`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.takeWhile]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.takeLastWhile]`)`[**`While`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.takeWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + *     `| `__`.`__[**`withoutNulls`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.withoutNulls]**`()`** + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     `| `[**`[`**][cols][`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` ..`[**`]`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] + * + *     `| `[**`[`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**[**`]`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] + * + *     `| `[**`{`**][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` `[`colsSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsSelectorDef]` `[**`}`**][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select] + * + *     `| `__`.`__[**`allCols`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]**`()`** + * + *     `| `**`.allCols`**`(`[**`Before`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`|`[**`After`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`|`[**`From`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`|`[**`UpTo`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`) ( `**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`)`**` | `**`{ `**[`colSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSelectorDef]**` }`**` )` + * + *     `| `__`.`__[**`allColsExcept`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept]**` { `**[`colsSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsSelectorDef]**` } `** + * + *     `| `__`.`__[**`allColsExcept`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept]**`(`**[`columnNoAccessor`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnNoAccessorDef]**`,`**` ..`**`)`** + * + *     `| `__`.`__[**`and`**][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]**` (`**`|`**`{ `**[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]**` }`**`|`**`)`** + * + *     `| (`__`.`__[**`col`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]`| `__`.`__[**`valueCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]`| `__`.`__[**`frameCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]`| `__`.`__[**`colGroup`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`)[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + *     `| (`__`.`__[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`| `__`.`__[**`valueCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`| `__`.`__[**`frameCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`| `__`.`__[**`colGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`) [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.`__[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` .. | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`,`**` .. | `[`indexRange`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexRangeDef]**`)`** + * + *     `| `__`.`__[**`colsAtAnyDepth`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.`__[**`colsInGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.colsName`__`(`[**`Starts`**][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameStartsWith]`|`[**`Ends`**][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameEndsWith]`)`**`With`**__`(`__[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`]`**`)`** + * + *     `| `__`.`__[**`colsNameContains`**][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameContains]**`(`**[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`] | `[`regex`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.RegexDef]**`)`** + * + *     `| `__`.`__[**`colsOfKind`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]**`(`**[`kind`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnKindDef]**`,`**` ..`**`)`**` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.`__[**`colsWithoutNulls`**][org.jetbrains.kotlinx.dataframe.api.WithoutNullsColumnsSelectionDsl.colsWithoutNulls]**`()`** + * + *     `| `__`.`__[**`drop`**][org.jetbrains.kotlinx.dataframe.api.DropColumnsSelectionDsl.dropCols]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.api.DropColumnsSelectionDsl.dropLastCols]`)`[**`Cols`**][org.jetbrains.kotlinx.dataframe.api.DropColumnsSelectionDsl.dropCols]**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + *     `| `__`.`__[**`drop`**][org.jetbrains.kotlinx.dataframe.api.DropColumnsSelectionDsl.dropColsWhile]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.api.DropColumnsSelectionDsl.dropLastColsWhile]`)`[**`ColsWhile`**][org.jetbrains.kotlinx.dataframe.api.DropColumnsSelectionDsl.dropColsWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + *     `| `[**`exceptNew`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.exceptNew]**` { `**[`colsSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsSelectorDef]**` } EXPERIMENTAL!`** + * + *     `| `[**`exceptNew`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.exceptNew]**`(`**[`columnNoAccessor`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnNoAccessorDef]**`,`**` ..`**`) EXPERIMENTAL!`** + * + *     `| (`__`.`__[**`firstCol`**][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.firstCol]`| `__`.`__[**`lastCol`**][org.jetbrains.kotlinx.dataframe.api.LastColumnsSelectionDsl.lastCol]`| `__`.`__[**`singleCol`**][org.jetbrains.kotlinx.dataframe.api.SingleColumnsSelectionDsl.singleCol]`) [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *     `| `__`.`__[**`select`**][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]**` { `**[`colsSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsSelectorDef]**` }`** + * + *     `| `__`.`__[**`take`**][org.jetbrains.kotlinx.dataframe.api.TakeColumnsSelectionDsl.takeCols]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.api.TakeColumnsSelectionDsl.takeLastCols]`)`[**`Cols`**][org.jetbrains.kotlinx.dataframe.api.TakeColumnsSelectionDsl.takeCols]**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + *     `| `__`.`__[**`take`**][org.jetbrains.kotlinx.dataframe.api.TakeColumnsSelectionDsl.takeColsWhile]`(`[**`Last`**][org.jetbrains.kotlinx.dataframe.api.TakeColumnsSelectionDsl.takeLastColsWhile]`)`[**`ColsWhile`**][org.jetbrains.kotlinx.dataframe.api.TakeColumnsSelectionDsl.takeColsWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + * + *      + * + * + * [`singleColumn`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.SingleColumnDef] + * + *     __`.`__[**`colsOf`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**` [ `**`(`**[`kType`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.KTypeDef]**`)`**` ] [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + *      + * + * + * [`columnGroupReference`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupNoSingleColumnDef] + * + *     __`.`__[**`colsOf`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>(`**[`kType`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.KTypeDef]**`)`**` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + */ + public interface DslGrammar + + /** + * Invokes the given [ColumnsSelector] using this [ColumnsSelectionDsl]. + */ + public operator fun ColumnsSelector.invoke(): ColumnsResolver = + this@invoke(this@ColumnsSelectionDsl, this@ColumnsSelectionDsl) + + // region select + // NOTE: due to invoke conflicts these cannot be moved out of the interface + + /** + * ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on + * any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all + * operations of the DSL are at your disposal. + * + * The scope of the new DSL instance is relative to + * the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from. + * + * The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` { someCol `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol" `[{][kotlin.String.select]` "colA" and `[expr][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]` { 0 } `[}][kotlin.String.select]` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[select][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.select]` { "colA" and "colB" } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { it["myGroupCol"].`[asColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.asColumnGroup]`()`[() {][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` "colA" and "colB" `[}][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColGroup.`[`select`][SingleColumn.select]` { someCol `[`and`][ColumnsSelectionDsl.and]` `[`colsOf`][SingleColumn.colsOf]`<`[`String`][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { myColGroup `[`{`][SingleColumn.select]` colA `[and][ColumnsSelectionDsl.and]` colB `[`}`][SingleColumn.select]` }` + * + * + *      + * + * + * See also [except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]/[allExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] for the inverted operation of this function. + * + * @param [selector] The [ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] to use for the selection. + * @receiver The [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] to select from. + * @throws [IllegalArgumentException] If [this] is not a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector]. + * @see [SingleColumn.except] + */ + public operator fun SingleColumn>.invoke(selector: ColumnsSelector): ColumnSet = + select(selector) + + /** + * ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on + * any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all + * operations of the DSL are at your disposal. + * + * The scope of the new DSL instance is relative to + * the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from. + * + * The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` { someCol `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol" `[{][kotlin.String.select]` "colA" and `[expr][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]` { 0 } `[}][kotlin.String.select]` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[select][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.select]` { "colA" and "colB" } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { it["myGroupCol"].`[asColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.asColumnGroup]`()`[() {][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` "colA" and "colB" `[}][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColGroup.`[`select`][KProperty.select]` { someCol `[`and`][ColumnsSelectionDsl.and]` `[`colsOf`][SingleColumn.colsOf]`<`[`String`][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColGroup `[`{`][KProperty.select]` colA `[`and`][ColumnsSelectionDsl.and]` colB `[`}`][KProperty.select]` }` + * + * + *      + * + * + * See also [except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]/[allExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] for the inverted operation of this function. + * + * @param [selector] The [ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] to use for the selection. + * @receiver The [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] to select from. + * @throws [IllegalArgumentException] If [this] is not a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector]. + * @see [SingleColumn.except] + */ + public operator fun KProperty.invoke(selector: ColumnsSelector): ColumnSet = + columnGroup(this).select(selector) + + /** + * ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on + * any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all + * operations of the DSL are at your disposal. + * + * The scope of the new DSL instance is relative to + * the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from. + * + * The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` { someCol `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol" `[{][kotlin.String.select]` "colA" and `[expr][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]` { 0 } `[}][kotlin.String.select]` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[select][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.select]` { "colA" and "colB" } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { it["myGroupCol"].`[asColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.asColumnGroup]`()`[() {][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` "colA" and "colB" `[}][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[`select`][String.select]` { someCol `[`and`][ColumnsSelectionDsl.and]` `[`colsOf`][SingleColumn.colsOf]`<`[`String`][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { "myColGroup" `[`{`][String.select]` colA `[`and`][ColumnsSelectionDsl.and]` colB `[`}`][String.select]` }` + * + * + *      + * + * + * See also [except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]/[allExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] for the inverted operation of this function. + * + * @param [selector] The [ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] to use for the selection. + * @receiver The [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] to select from. + * @throws [IllegalArgumentException] If [this] is not a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector]. + * @see [SingleColumn.except] + */ + public operator fun String.invoke(selector: ColumnsSelector<*, R>): ColumnSet = select(selector) + + /** + * ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on + * any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all + * operations of the DSL are at your disposal. + * + * The scope of the new DSL instance is relative to + * the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from. + * + * The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` { someCol `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol" `[{][kotlin.String.select]` "colA" and `[expr][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]` { 0 } `[}][kotlin.String.select]` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[select][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.select]` { "colA" and "colB" } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { it["myGroupCol"].`[asColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.asColumnGroup]`()`[() {][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` "colA" and "colB" `[}][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColGroup"].`[`select`][ColumnPath.select]` { someCol `[`and`][ColumnsSelectionDsl.and]` `[`colsOf`][SingleColumn.colsOf]`<`[`String`][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColGroup"] `[`{`][ColumnPath.select]` colA `[`and`][ColumnsSelectionDsl.and]` colB `[`}`][ColumnPath.select]` }` + * + * `df.`[select][DataFrame.select]` { `[`pathOf`][pathOf]`("pathTo", "myColGroup").`[`select`][ColumnPath.select]` { someCol `[`and`][ColumnsSelectionDsl.and]` `[`colsOf`][SingleColumn.colsOf]`<`[`String`][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { `[`pathOf`][pathOf]`("pathTo", "myColGroup")`[`() {`][ColumnPath.select]` someCol `[`and`][ColumnsSelectionDsl.and]` `[`colsOf`][SingleColumn.colsOf]`<`[`String`][String]`>() `[`}`][ColumnPath.select]` }` + * + * + *      + * + * + * See also [except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]/[allExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] for the inverted operation of this function. + * + * @param [selector] The [ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] to use for the selection. + * @receiver The [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] to select from. + * @throws [IllegalArgumentException] If [this] is not a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector]. + * @see [SingleColumn.except] + */ + public operator fun ColumnPath.invoke(selector: ColumnsSelector<*, R>): ColumnSet = select(selector) + + // endregion +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataColumnArithmetics.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataColumnArithmetics.kt new file mode 100644 index 000000000..6879c8acc --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataColumnArithmetics.kt @@ -0,0 +1,180 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.Predicate +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import java.math.BigDecimal + +public operator fun DataColumn.not(): DataColumn = map { !it } + +@JvmName("notBooleanNullable") +public operator fun DataColumn.not(): DataColumn = map { it?.not() } + +public operator fun ColumnReference.not(): ColumnReference = map { !it } + +@JvmName("notBooleanNullable") +public operator fun ColumnReference.not(): ColumnReference = map { it?.not() } + +public operator fun DataColumn.plus(value: Int): DataColumn = map { it + value } + +public operator fun DataColumn.minus(value: Int): DataColumn = map { it - value } + +public operator fun Int.plus(column: DataColumn): DataColumn = column.map { this + it } + +public operator fun Int.minus(column: DataColumn): DataColumn = column.map { this - it } + +public operator fun DataColumn.unaryMinus(): DataColumn = map { -it } + +public operator fun DataColumn.times(value: Int): DataColumn = map { it * value } + +public operator fun DataColumn.div(value: Int): DataColumn = map { it / value } + +public operator fun Int.div(column: DataColumn): DataColumn = column.map { this / it } + +public operator fun AnyCol.plus(str: String): DataColumn = map { it.toString() + str } + +public operator fun ColumnReference.plus(value: Int): ColumnReference = map { it + value } + +public operator fun ColumnReference.minus(value: Int): ColumnReference = map { it - value } + +public operator fun Int.plus(column: ColumnReference): ColumnReference = column.map { this + it } + +public operator fun Int.minus(column: ColumnReference): ColumnReference = column.map { this - it } + +public operator fun ColumnReference.unaryMinus(): ColumnReference = map { -it } + +public operator fun ColumnReference.times(value: Int): ColumnReference = map { it * value } + +public operator fun ColumnReference.div(value: Int): ColumnReference = map { it / value } + +public operator fun Int.div(column: ColumnReference): ColumnReference = column.map { this / it } + +public operator fun ColumnReference.plus(str: String): ColumnReference = map { it.toString() + str } + +@JvmName("plusIntNullable") +public operator fun DataColumn.plus(value: Int): DataColumn = map { it?.plus(value) } + +@JvmName("minusIntNullable") +public operator fun DataColumn.minus(value: Int): DataColumn = map { it?.minus(value) } + +@JvmName("plusNullable") +public operator fun Int.plus(column: DataColumn): DataColumn = column.map { it?.plus(this) } + +@JvmName("minusNullable") +public operator fun Int.minus(column: DataColumn): DataColumn = column.map { it?.let { this - it } } + +@JvmName("unaryMinusIntNullable") +public operator fun DataColumn.unaryMinus(): DataColumn = map { it?.unaryMinus() } + +@JvmName("timesIntNullable") +public operator fun DataColumn.times(value: Int): DataColumn = map { it?.times(value) } + +@JvmName("divIntNullable") +public operator fun DataColumn.div(value: Int): DataColumn = map { it?.div(value) } + +@JvmName("divNullable") +public operator fun Int.div(column: DataColumn): DataColumn = column.map { it?.let { this / it } } + +@JvmName("plusInt") +public operator fun DataColumn.plus(value: Double): DataColumn = map { it + value } + +@JvmName("minusInt") +public operator fun DataColumn.minus(value: Double): DataColumn = map { it - value } + +@JvmName("doublePlus") +public operator fun Double.plus(column: DataColumn): DataColumn = column.map { this + it } + +@JvmName("doubleMinus") +public operator fun Double.minus(column: DataColumn): DataColumn = column.map { this - it } + +@JvmName("timesInt") +public operator fun DataColumn.times(value: Double): DataColumn = map { it * value } + +@JvmName("divInt") +public operator fun DataColumn.div(value: Double): DataColumn = map { it / value } + +@JvmName("doubleDiv") +public operator fun Double.div(column: DataColumn): DataColumn = column.map { this / it } + +@JvmName("plusDouble") +public operator fun DataColumn.plus(value: Int): DataColumn = map { it + value } + +@JvmName("minusDouble") +public operator fun DataColumn.minus(value: Int): DataColumn = map { it - value } + +@JvmName("intPlus") +public operator fun Int.plus(column: DataColumn): DataColumn = column.map { this + it } + +@JvmName("intMinus") +public operator fun Int.minus(column: DataColumn): DataColumn = column.map { this - it } + +@JvmName("timesDouble") +public operator fun DataColumn.times(value: Int): DataColumn = map { it * value } + +@JvmName("divDouble") +public operator fun DataColumn.div(value: Int): DataColumn = map { it / value } + +@JvmName("intDiv") +public operator fun Int.div(column: DataColumn): DataColumn = column.map { this / it } + +public operator fun DataColumn.plus(value: Double): DataColumn = map { it + value } + +public operator fun DataColumn.minus(value: Double): DataColumn = map { it - value } + +public operator fun Double.plus(column: DataColumn): DataColumn = column.map { this + it } + +public operator fun Double.minus(column: DataColumn): DataColumn = column.map { this - it } + +@JvmName("unaryMinusDouble") +public operator fun DataColumn.unaryMinus(): DataColumn = map { -it } + +public operator fun DataColumn.times(value: Double): DataColumn = map { it * value } + +public operator fun DataColumn.div(value: Double): DataColumn = map { it / value } + +public operator fun Double.div(column: DataColumn): DataColumn = column.map { this / it } + +public operator fun DataColumn.plus(value: Long): DataColumn = map { it + value } + +public operator fun DataColumn.minus(value: Long): DataColumn = map { it - value } + +public operator fun Long.plus(column: DataColumn): DataColumn = column.map { this + it } + +public operator fun Long.minus(column: DataColumn): DataColumn = column.map { this - it } + +@JvmName("unaryMinusLong") +public operator fun DataColumn.unaryMinus(): DataColumn = map { -it } + +public operator fun DataColumn.times(value: Long): DataColumn = map { it * value } + +public operator fun DataColumn.div(value: Long): DataColumn = map { it / value } + +public operator fun Long.div(column: DataColumn): DataColumn = column.map { this / it } + +public operator fun DataColumn.plus(value: BigDecimal): DataColumn = map { it + value } + +public operator fun DataColumn.minus(value: BigDecimal): DataColumn = map { it - value } + +public operator fun BigDecimal.plus(column: DataColumn): DataColumn = column.map { this + it } + +public operator fun BigDecimal.minus(column: DataColumn): DataColumn = column.map { this - it } + +@JvmName("unaryMinusBigDecimal") +public operator fun DataColumn.unaryMinus(): DataColumn = map { -it } + +public operator fun DataColumn.times(value: BigDecimal): DataColumn = map { it * value } + +public operator fun DataColumn.div(value: BigDecimal): DataColumn = map { it / value } + +public operator fun BigDecimal.div(column: DataColumn): DataColumn = column.map { this / it } + +public infix fun DataColumn.eq(value: T): DataColumn = isMatching { it == value } + +public infix fun DataColumn.neq(value: T): DataColumn = isMatching { it != value } + +public infix fun > DataColumn.gt(value: T): DataColumn = isMatching { it > value } + +public infix fun > DataColumn.lt(value: T): DataColumn = isMatching { it < value } + +internal fun DataColumn.isMatching(predicate: Predicate): DataColumn = map { predicate(it) } diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataColumnType.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataColumnType.kt new file mode 100644 index 000000000..2c7887ab3 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataColumnType.kt @@ -0,0 +1,68 @@ +@file:OptIn(ExperimentalContracts::class) + +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnKind +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.ValueColumn +import org.jetbrains.kotlinx.dataframe.impl.isNothing +import org.jetbrains.kotlinx.dataframe.impl.projectTo +import org.jetbrains.kotlinx.dataframe.type +import org.jetbrains.kotlinx.dataframe.typeClass +import kotlin.contracts.ExperimentalContracts +import kotlin.contracts.contract +import kotlin.reflect.KClass +import kotlin.reflect.KType +import kotlin.reflect.KTypeProjection +import kotlin.reflect.full.isSubclassOf +import kotlin.reflect.full.isSubtypeOf +import kotlin.reflect.typeOf + +public fun AnyCol.isColumnGroup(): Boolean { + contract { returns(true) implies (this@isColumnGroup is ColumnGroup<*>) } + return kind() == ColumnKind.Group +} + +public fun AnyCol.isFrameColumn(): Boolean { + contract { returns(true) implies (this@isFrameColumn is FrameColumn<*>) } + return kind() == ColumnKind.Frame +} + +public fun AnyCol.isValueColumn(): Boolean { + contract { returns(true) implies (this@isValueColumn is ValueColumn<*>) } + return kind() == ColumnKind.Value +} + +public fun AnyCol.isSubtypeOf(type: KType): Boolean = + this.type.isSubtypeOf(type) && (!this.type.isMarkedNullable || type.isMarkedNullable) + +public inline fun AnyCol.isSubtypeOf(): Boolean = isSubtypeOf(typeOf()) + +public inline fun AnyCol.isType(): Boolean = type() == typeOf() + +public fun AnyCol.isNumber(): Boolean = isSubtypeOf() + +public fun AnyCol.isList(): Boolean = typeClass == List::class + +/** + * Returns `true` if [this] column is comparable, i.e. its type is a subtype of [Comparable] and its + * type argument is not [Nothing]. + */ +public fun AnyCol.isComparable(): Boolean = + isSubtypeOf?>() && + type().projectTo(Comparable::class).arguments[0].let { + it != KTypeProjection.STAR && + it.type?.isNothing != true + } + +@PublishedApi +internal fun AnyCol.isPrimitive(): Boolean = typeClass.isPrimitive() + +internal fun KClass<*>.isPrimitive(): Boolean = + isSubclassOf(Number::class) || + this == String::class || + this == Char::class || + this == Array::class || + isSubclassOf(Collection::class) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataFrameGet.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataFrameGet.kt new file mode 100644 index 000000000..c5322aa2e --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataFrameGet.kt @@ -0,0 +1,155 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnSelector +import org.jetbrains.kotlinx.dataframe.ColumnsContainer +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.UnresolvedColumnsPolicy +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.columns.asAnyFrameColumn +import org.jetbrains.kotlinx.dataframe.impl.getColumnPaths +import org.jetbrains.kotlinx.dataframe.impl.getColumnsWithPaths +import org.jetbrains.kotlinx.dataframe.ncol +import org.jetbrains.kotlinx.dataframe.nrow +import kotlin.reflect.KProperty + +public fun DataFrame.getColumnsWithPaths(selector: ColumnsSelector): List> = + getColumnsWithPaths(UnresolvedColumnsPolicy.Fail, selector) + +public fun DataFrame.getColumnPath(selector: ColumnSelector): ColumnPath = + getColumnPaths(selector).single() + +public fun DataFrame.getColumnPaths(selector: ColumnsSelector): List = + getColumnPaths(UnresolvedColumnsPolicy.Fail, selector) + +public fun DataFrame.getColumnWithPath(selector: ColumnSelector): ColumnWithPath = + getColumnsWithPaths(selector).single() + +public fun DataFrame.getColumns(selector: ColumnsSelector): List> = get(selector) + +public fun DataFrame.getColumns(vararg columns: String): List = getColumns { columns.toColumnSet() } + +public fun DataFrame.getColumnIndex(col: AnyCol): Int = getColumnIndex(col.name()) + +public fun DataFrame.getRows(range: IntRange): DataFrame = + if (range == indices()) this else columns().map { col -> col[range] }.toDataFrame().cast() + +public fun DataFrame.getRows(indices: Iterable): DataFrame = + columns().map { col -> col[indices] }.toDataFrame().cast() + +public fun DataFrame.getOrNull(index: Int): DataRow? = if (index < 0 || index >= nrow) null else get(index) + +public fun ColumnsContainer.getFrameColumn(columnPath: ColumnPath): FrameColumn<*> = + get(columnPath).asAnyFrameColumn() + +public fun ColumnsContainer.getFrameColumn(columnName: String): FrameColumn<*> = + get(columnName).asAnyFrameColumn() + +public fun ColumnsContainer.getColumnGroup(columnPath: ColumnPath): ColumnGroup<*> = + get(columnPath).asColumnGroup() + +// region getColumn + +public fun ColumnsContainer.getColumn(name: String): AnyCol = + getColumnOrNull(name) ?: throw IllegalArgumentException("Column not found: '$name'") + +public fun ColumnsContainer.getColumn(column: ColumnReference>): FrameColumn = + getColumnOrNull(column)?.asFrameColumn() ?: throw IllegalArgumentException("FrameColumn not found: '$column'") + +public fun ColumnsContainer.getColumn(column: ColumnReference>): ColumnGroup = + getColumnOrNull(column)?.asColumnGroup() ?: throw IllegalArgumentException("ColumnGroup not found: '$column'") + +public fun ColumnsContainer.getColumn(column: ColumnReference): DataColumn = + getColumnOrNull(column) ?: throw IllegalArgumentException("Column not found: '$column'") + +public fun ColumnsContainer.getColumn(path: ColumnPath): AnyCol = + getColumnOrNull(path) ?: throw IllegalArgumentException("Column not found: '$path'") + +public fun ColumnsContainer.getColumn(index: Int): AnyCol = + getColumnOrNull(index) + ?: throw IllegalArgumentException("Column index is out of bounds: $index. Columns count = $ncol") + +public fun ColumnsContainer.getColumn(selector: ColumnSelector): DataColumn = get(selector) + +// endregion + +// region getColumnGroup + +public fun ColumnsContainer.getColumnGroup(index: Int): ColumnGroup<*> = getColumn(index).asColumnGroup() + +public fun ColumnsContainer.getColumnGroup(name: String): ColumnGroup<*> = getColumn(name).asColumnGroup() + +public fun ColumnsContainer.getColumnGroup(column: KProperty<*>): ColumnGroup<*> = + getColumnGroup(column.columnName) + +public fun ColumnsContainer.getColumnGroup(column: ColumnReference>): ColumnGroup = + getColumn(column) + +public fun ColumnsContainer.getColumnGroup(column: ColumnSelector>): ColumnGroup = + get(column).asColumnGroup() + +// endregion + +// region getColumnGroupOrNull + +public fun ColumnsContainer.getColumnGroupOrNull(name: String): ColumnGroup<*>? = + getColumnOrNull(name)?.asColumnGroup() + +public fun ColumnsContainer.getColumnGroupOrNull(column: KProperty<*>): ColumnGroup<*>? = + getColumnGroupOrNull(column.columnName) + +// endregion + +// region containsColumn + +public fun ColumnsContainer<*>.containsColumn(column: ColumnReference): Boolean = getColumnOrNull(column) != null + +public fun ColumnsContainer<*>.containsColumn(column: KProperty<*>): Boolean = containsColumn(column.columnName) + +public operator fun ColumnsContainer<*>.contains(column: AnyColumnReference): Boolean = containsColumn(column) + +public operator fun ColumnsContainer<*>.contains(column: KProperty<*>): Boolean = containsColumn(column) + +// region rows + +public fun DataFrame.rows(): Iterable> = + object : Iterable> { + override fun iterator() = + object : Iterator> { + var nextRow = 0 + + override fun hasNext(): Boolean = nextRow < nrow + + override fun next(): DataRow { + require(nextRow < nrow) + return get(nextRow++) + } + } + } + +public fun DataFrame.rowsReversed(): Iterable> = + object : Iterable> { + override fun iterator() = + object : Iterator> { + var nextRow = nrow - 1 + + override fun hasNext(): Boolean = nextRow >= 0 + + override fun next(): DataRow { + require(nextRow >= 0) + return get(nextRow--) + } + } + } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowApi.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowApi.kt new file mode 100644 index 000000000..568abfe0b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowApi.kt @@ -0,0 +1,216 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnsContainer +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.annotations.DataSchema +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.owner +import org.jetbrains.kotlinx.dataframe.index +import org.jetbrains.kotlinx.dataframe.indices +import org.jetbrains.kotlinx.dataframe.ncol +import org.jetbrains.kotlinx.dataframe.nrow +import kotlin.experimental.ExperimentalTypeInference +import kotlin.reflect.KProperty +import kotlin.reflect.KType + +public fun AnyRow.isEmpty(): Boolean = owner.columns().all { it[index] == null } + +public fun AnyRow.isNotEmpty(): Boolean = !isEmpty() + +public inline fun AnyRow.valuesOf(): List = values().filterIsInstance() + +// region DataSchema +@DataSchema +public data class NameValuePair(val name: String, val value: V) + +// Without these overloads row.transpose().name or row.map { name } won't resolve +public val ColumnsContainer>.name: DataColumn + @JvmName("NameValuePairAny_name") + get() = this["name"] as DataColumn + +public val DataRow>.name: String + @JvmName("NameValuePairAny_name") + get() = this["name"] as String + +public val ColumnsContainer>.value: DataColumn<*> + @JvmName("NameValuePairAny_value") + get() = this["value"] + +public val DataRow>.value: Any? + @JvmName("NameValuePairAny_value") + get() = this["value"] + +// endregion + +public inline fun AnyRow.namedValuesOf(): List> = + values().zip(columnNames()).filter { it.first is R }.map { NameValuePair(it.second, it.first as R) } + +public fun AnyRow.namedValues(): List> = + values().zip(columnNames()) { value, name -> NameValuePair(name, value) } + +// region getValue + +public fun AnyRow.getValue(columnName: String): T = get(columnName) as T + +public fun AnyRow.getValue(column: ColumnReference): T = get(column) + +public fun AnyRow.getValue(column: KProperty): T = get(column) + +public fun AnyRow.getValueOrNull(columnName: String): T? = getOrNull(columnName) as T? + +public fun AnyRow.getValueOrNull(column: KProperty): T? = getValueOrNull(column.columnName) + +// endregion + +// region contains + +public fun AnyRow.containsKey(columnName: String): Boolean = owner.containsColumn(columnName) + +public fun AnyRow.containsKey(column: AnyColumnReference): Boolean = owner.containsColumn(column) + +public fun AnyRow.containsKey(column: KProperty<*>): Boolean = owner.containsColumn(column) + +public operator fun AnyRow.contains(column: AnyColumnReference): Boolean = containsKey(column) + +public operator fun AnyRow.contains(column: KProperty<*>): Boolean = containsKey(column) + +// endregion + +/** + * Calculates the difference between the results of a row expression computed on the current and previous DataRow. + * + * @return [firstRowValue] for the first row; difference between expression computed for current and previous row for the following rows + */ +internal interface DiffDocs + +/** + * Calculates the difference between the results of a row expression computed on the current and previous DataRow. + * + * @return null for the first row; difference between expression computed for current and previous row for the following rows + */ +internal interface DiffOrNullDocs + +/** + * Calculates the difference between the results of a row expression computed on the current and previous DataRow. + * + * @return [firstRowValue] for the first row; difference between expression computed for current and previous row for the following rows + */ +@OptIn(ExperimentalTypeInference::class) +@OverloadResolutionByLambdaReturnType +public fun DataRow.diff(firstRowResult: Double, expression: RowExpression): Double = + prev()?.let { p -> expression(this, this) - expression(p, p) } + ?: firstRowResult + +/** + * Calculates the difference between the results of a row expression computed on the current and previous DataRow. + * + * @return [firstRowValue] for the first row; difference between expression computed for current and previous row for the following rows + */ +@OptIn(ExperimentalTypeInference::class) +@OverloadResolutionByLambdaReturnType +// required to resolve `diff(0) { intValue }` +public fun DataRow.diff(firstRowResult: Int, expression: RowExpression): Int = + prev()?.let { p -> expression(this, this) - expression(p, p) } + ?: firstRowResult + +/** + * Calculates the difference between the results of a row expression computed on the current and previous DataRow. + * + * @return [firstRowValue] for the first row; difference between expression computed for current and previous row for the following rows + */ +public fun DataRow.diff(firstRowResult: Long, expression: RowExpression): Long = + prev()?.let { p -> expression(this, this) - expression(p, p) } + ?: firstRowResult + +/** + * Calculates the difference between the results of a row expression computed on the current and previous DataRow. + * + * @return [firstRowValue] for the first row; difference between expression computed for current and previous row for the following rows + */ +public fun DataRow.diff(firstRowResult: Float, expression: RowExpression): Float = + prev()?.let { p -> expression(this, this) - expression(p, p) } + ?: firstRowResult + +/** + * Calculates the difference between the results of a row expression computed on the current and previous DataRow. + * + * @return null for the first row; difference between expression computed for current and previous row for the following rows + */ +@OptIn(ExperimentalTypeInference::class) +@OverloadResolutionByLambdaReturnType +public fun DataRow.diffOrNull(expression: RowExpression): Double? = + prev()?.let { p -> expression(this, this) - expression(p, p) } + +/** + * Calculates the difference between the results of a row expression computed on the current and previous DataRow. + * + * @return null for the first row; difference between expression computed for current and previous row for the following rows + */ +public fun DataRow.diffOrNull(expression: RowExpression): Int? = + prev()?.let { p -> expression(this, this) - expression(p, p) } + +/** + * Calculates the difference between the results of a row expression computed on the current and previous DataRow. + * + * @return null for the first row; difference between expression computed for current and previous row for the following rows + */ +public fun DataRow.diffOrNull(expression: RowExpression): Long? = + prev()?.let { p -> expression(this, this) - expression(p, p) } + +/** + * Calculates the difference between the results of a row expression computed on the current and previous DataRow. + * + * @return null for the first row; difference between expression computed for current and previous row for the following rows + */ +public fun DataRow.diffOrNull(expression: RowExpression): Float? = + prev()?.let { p -> expression(this, this) - expression(p, p) } + +public fun AnyRow.columnsCount(): Int = df().ncol + +public fun AnyRow.columnNames(): List = df().columnNames() + +public fun AnyRow.columnTypes(): List = df().columnTypes() + +public fun DataRow.getRow(index: Int): DataRow = getRowOrNull(index)!! + +public fun DataRow.getRows(indices: Iterable): DataFrame = df().getRows(indices) + +public fun DataRow.getRows(indices: IntRange): DataFrame = df().getRows(indices) + +public fun DataRow.getRowOrNull(index: Int): DataRow? { + val df = df() + return if (index >= 0 && index < df.nrow) df[index] else null +} + +public fun DataRow.prev(): DataRow? { + val index = index() + return if (index > 0) df()[index - 1] else null +} + +public fun DataRow.next(): DataRow? { + val index = index() + val df = df() + return if (index < df.nrow - 1) df[index + 1] else null +} + +public fun DataRow.relative(relativeIndices: Iterable): DataFrame = + getRows(relativeIndices.mapNotNull { (index + it).let { if (it >= 0 && it < df().rowsCount()) it else null } }) + +public fun DataRow.relative(relativeIndices: IntRange): DataFrame = + getRows( + (relativeIndices.first + index).coerceIn(df().indices)..(relativeIndices.last + index).coerceIn(df().indices), + ) + +public fun DataRow.movingAverage(k: Int, expression: RowExpression): Double { + var count = 0 + return backwardIterable().take(k).sumOf { + count++ + expression(it).toDouble() + } / count +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowSchemaApi.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowSchemaApi.kt new file mode 100644 index 000000000..774ac357b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/DataRowSchemaApi.kt @@ -0,0 +1,11 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame + +public interface DataRowSchema + +public inline fun dataFrameOf(vararg rows: T): DataFrame = + rows.asIterable().toDataFrame() + +public inline fun DataFrame.append(vararg rows: T): DataFrame = + concat(dataFrameOf(*rows)) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/Defaults.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/Defaults.kt new file mode 100644 index 000000000..646954aa4 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/Defaults.kt @@ -0,0 +1,7 @@ +package org.jetbrains.kotlinx.dataframe.api + +@PublishedApi +internal val skipNA_default: Boolean = false + +@PublishedApi +internal val ddof_default: Int = 1 diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/JsonPath.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/JsonPath.kt new file mode 100644 index 000000000..0150eb2bc --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/JsonPath.kt @@ -0,0 +1,68 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.intellij.lang.annotations.Language +import java.io.Serializable + +/** + * Simplistic JSON path implementation. + * Supports just keys (in bracket notation), double quotes, arrays, and wildcards. + * + * Examples: + * `$["store"]["book"][*]["author"]` + * + * `$[1]` will match `$[*]` + */ +@JvmInline +public value class JsonPath( + @Language("jsonpath") public val path: String = "$", +) : Serializable { + + public fun append(name: String): JsonPath = JsonPath("$path[\"$name\"]") + + public fun appendWildcard(): JsonPath = JsonPath("$path[*]") + + public fun appendArrayWithIndex(index: Int): JsonPath = JsonPath("$path[$index]") + + public fun appendArrayWithWildcard(): JsonPath = JsonPath("$path[*]") + + public fun replaceLastWildcardWithIndex(index: Int): JsonPath = + JsonPath( + path.toCharArray().let { chars -> + val lastStarIndex = chars.lastIndexOf('*') + chars.flatMapIndexed { i, c -> + if (i == lastStarIndex) { + index.toString().toCharArray().toList() + } else { + listOf(c) + } + }.joinToString("") + }, + ) + + public fun prepend(name: String): JsonPath = JsonPath("\$[\"$name\"]" + path.removePrefix("$")) + + public fun prependWildcard(): JsonPath = JsonPath("\$[*]" + path.removePrefix("$")) + + public fun prependArrayWithIndex(index: Int): JsonPath = JsonPath("\$[$index]" + path.removePrefix("$")) + + public fun prependArrayWithWildcard(): JsonPath = JsonPath("\$[*]" + path.removePrefix("$")) + + public fun erasedIndices(): JsonPath = JsonPath(path.replace("""\[[0-9]+]""".toRegex(), "[*]")) + + private fun splitPath() = path.split("[", "]").filter { it.isNotBlank() } + + public fun matches(other: JsonPath): Boolean = + path == other.path || + run { + val path = splitPath() + val otherPath = other.splitPath() + + if (path.size != otherPath.size) { + false + } else { + path.zip(otherPath).all { (p, o) -> + p == o || p == "*" || o == "*" + } + } + } +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/KeyValueProperty.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/KeyValueProperty.kt new file mode 100644 index 000000000..56a52c2f3 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/KeyValueProperty.kt @@ -0,0 +1,15 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.annotations.ColumnName +import org.jetbrains.kotlinx.dataframe.annotations.DataSchema + +/** A [DataSchema] interface / class can implement this if it represents a map-like data schema (so key: value). */ +@DataSchema +public interface KeyValueProperty { + // needs to be explicitly overridden in @DataSchema interface, otherwise extension functions won't generate (TODO) + public val key: String + + // needs to be explicitly overridden in @DataSchema interface, otherwise type will be read as `T` and extensions won't generate (TODO) + @ColumnName("value") + public val `value`: T +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/Nulls.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/Nulls.kt new file mode 100644 index 000000000..10efb54a9 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/Nulls.kt @@ -0,0 +1,1387 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.api.DropNA.DropNASelectingOptions +import org.jetbrains.kotlinx.dataframe.api.DropNaNs.DropNaNsSelectingOptions +import org.jetbrains.kotlinx.dataframe.api.DropNulls.DropNullsSelectingOptions +import org.jetbrains.kotlinx.dataframe.columns.ColumnKind +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.documentation.NA +import org.jetbrains.kotlinx.dataframe.documentation.NaN +import org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns +import org.jetbrains.kotlinx.dataframe.get +import org.jetbrains.kotlinx.dataframe.typeClass +import kotlin.reflect.KProperty + +// region fillNulls + +/** + * ## The Fill Nulls Operation + * + * Replaces `null` values with given value or expression. + * Specific case of [update]. + * + * ### Check out: [Grammar][FillNulls.Grammar] + * + * For more information: [See `fillNulls` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillnulls) + */ +internal interface FillNulls { + + /** ## [**fillNulls**][fillNulls] Operation Grammar + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + * + *      + * + * + * [**fillNulls**][fillNulls]**` { `**[`columns`][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns]**` }`** + * + *      + * `[ `__`.`__[**`where`**][org.jetbrains.kotlinx.dataframe.api.Update.where]**` { `**[`rowValueCondition`][org.jetbrains.kotlinx.dataframe.documentation.SelectingRows.RowValueCondition.WithExample]**` } `**`]` + * + *      + * `[ `__`.`__[**`at`**][org.jetbrains.kotlinx.dataframe.api.Update.at]**`(`**[`rowIndices`][org.jetbrains.kotlinx.dataframe.api.CommonUpdateAtFunctionDoc.RowIndicesParam]**`)`**` ]` + * + *      + * __`.`__[**`with`**][org.jetbrains.kotlinx.dataframe.api.Update.with]**` { `**[`rowExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowValueExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`notNull`**][org.jetbrains.kotlinx.dataframe.api.Update.notNull]**` { `**[`rowExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowValueExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`perCol`**][org.jetbrains.kotlinx.dataframe.api.Update.perCol]**` { `**[`colExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenColumn.ColumnExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`perRowCol`**][org.jetbrains.kotlinx.dataframe.api.Update.perRowCol]**` { `**[`rowColExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRowAndColumn.RowColumnExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`withNull`**][org.jetbrains.kotlinx.dataframe.api.Update.withNull]**`()`** + * + *      + * `| `__`.`__[**`withZero`**][org.jetbrains.kotlinx.dataframe.api.Update.withZero]**`()`** + * + *      + * `| `__`.`__[**`asFrame`**][org.jetbrains.kotlinx.dataframe.api.Update.asFrame]**` { `**[`dataFrameExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenDataFrame.DataFrameExpression.WithExample]**` }`** + * + */ + interface Grammar + + /** + * + * ## Selecting Columns + * Selecting columns for various operations (including but not limited to + * [DataFrame.select][org.jetbrains.kotlinx.dataframe.DataFrame.select], [DataFrame.update][org.jetbrains.kotlinx.dataframe.DataFrame.update], [DataFrame.gather][org.jetbrains.kotlinx.dataframe.DataFrame.gather], and [DataFrame.fillNulls][org.jetbrains.kotlinx.dataframe.DataFrame.fillNulls]) + * can be done in the following ways: + * ### 1. [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.Dsl.WithExample] + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * #### NOTE: There's also a 'single column' variant used sometimes: [Column Selection DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.DslSingle.WithExample]. + * ### 2. [Column names][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnNames.WithExample] + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]`("length", "age")` + * + * ### 3. [Column references][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnAccessors.WithExample] + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]`(length, age)` + * + * ### 4. [KProperties][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.KProperties.WithExample] + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]`(Person::length, Person::age)` + * + */ + interface FillNullsSelectingOptions +} + +private interface SetFillNullsOperationArg + +/** + * ## The Fill Nulls Operation + * + * Replaces `null` values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNulls.Grammar] + * + * For more information: [See `fillNulls` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillnulls) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNulls.FillNullsSelectingOptions] + * for all the selecting options. + * + * ### This Fill Nulls Overload + * + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * @param [columns] The [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +@Interpretable("FillNulls0") +public fun DataFrame.fillNulls(columns: ColumnsSelector): Update = + update(columns).where { it == null } + +/** + * ## The Fill Nulls Operation + * + * Replaces `null` values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNulls.Grammar] + * + * For more information: [See `fillNulls` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillnulls) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNulls.FillNullsSelectingOptions] + * for all the selecting options. + * + * ### This Fill Nulls Overload + * + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]`("length", "age")` + * + * @param [columns] The [Strings][String] corresponding to the names of columns belonging to this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNulls(vararg columns: String): Update = fillNulls { columns.toColumnSet() } + +/** + * ## The Fill Nulls Operation + * + * Replaces `null` values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNulls.Grammar] + * + * For more information: [See `fillNulls` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillnulls) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNulls.FillNullsSelectingOptions] + * for all the selecting options. + * + * ### This Fill Nulls Overload + * + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]`(Person::length, Person::age)` + * + * @param [columns] The [KProperties][KProperty] corresponding to columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNulls(vararg columns: KProperty): Update = + fillNulls { columns.toColumnSet() } + +/** + * ## The Fill Nulls Operation + * + * Replaces `null` values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNulls.Grammar] + * + * For more information: [See `fillNulls` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillnulls) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNulls.FillNullsSelectingOptions] + * for all the selecting options. + * + * ### This Fill Nulls Overload + * + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[fillNulls][org.jetbrains.kotlinx.dataframe.api.fillNulls]`(length, age)` + * + * @param [columns] The [Column References][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNulls(vararg columns: ColumnReference): Update = + fillNulls { columns.toColumnSet() } + +// endregion + +internal inline val Any?.isNaN: Boolean get() = (this is Double && isNaN()) || (this is Float && isNaN()) + +internal inline val Any?.isNA: Boolean + get() = when (this) { + null -> true + is Double -> isNaN() + is Float -> isNaN() + is AnyRow -> allNA() + is AnyFrame -> isEmpty() + else -> false + } + +internal inline val AnyCol.canHaveNaN: Boolean get() = typeClass.let { it == Double::class || it == Float::class } + +internal inline val AnyCol.canHaveNA: Boolean get() = hasNulls() || canHaveNaN || kind() != ColumnKind.Value + +internal inline val Double?.isNA: Boolean get() = this == null || this.isNaN() + +internal inline val Float?.isNA: Boolean get() = this == null || this.isNaN() + +// region fillNaNs + +/** + * ## The Fill NaNs Operation + * + * Replaces [`NaN`][NaN] values with given value or expression. + * Specific case of [update]. + * + * ### Check out: [Grammar][FillNaNs.Grammar] + * + * For more information: [See `fillNaNs` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillnans) + */ +internal interface FillNaNs { + + /** ## [fillNaNs][fillNaNs] Operation Grammar + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + * + *      + * + * + * [fillNaNs][fillNaNs]**` { `**[`columns`][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns]**` }`** + * + *      + * `[ `__`.`__[**`where`**][org.jetbrains.kotlinx.dataframe.api.Update.where]**` { `**[`rowValueCondition`][org.jetbrains.kotlinx.dataframe.documentation.SelectingRows.RowValueCondition.WithExample]**` } `**`]` + * + *      + * `[ `__`.`__[**`at`**][org.jetbrains.kotlinx.dataframe.api.Update.at]**`(`**[`rowIndices`][org.jetbrains.kotlinx.dataframe.api.CommonUpdateAtFunctionDoc.RowIndicesParam]**`)`**` ]` + * + *      + * __`.`__[**`with`**][org.jetbrains.kotlinx.dataframe.api.Update.with]**` { `**[`rowExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowValueExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`notNull`**][org.jetbrains.kotlinx.dataframe.api.Update.notNull]**` { `**[`rowExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowValueExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`perCol`**][org.jetbrains.kotlinx.dataframe.api.Update.perCol]**` { `**[`colExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenColumn.ColumnExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`perRowCol`**][org.jetbrains.kotlinx.dataframe.api.Update.perRowCol]**` { `**[`rowColExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRowAndColumn.RowColumnExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`withNull`**][org.jetbrains.kotlinx.dataframe.api.Update.withNull]**`()`** + * + *      + * `| `__`.`__[**`withZero`**][org.jetbrains.kotlinx.dataframe.api.Update.withZero]**`()`** + * + *      + * `| `__`.`__[**`asFrame`**][org.jetbrains.kotlinx.dataframe.api.Update.asFrame]**` { `**[`dataFrameExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenDataFrame.DataFrameExpression.WithExample]**` }`** + * + */ + interface Grammar + + /** + * + * ## Selecting Columns + * Selecting columns for various operations (including but not limited to + * [DataFrame.select][org.jetbrains.kotlinx.dataframe.DataFrame.select], [DataFrame.update][org.jetbrains.kotlinx.dataframe.DataFrame.update], [DataFrame.gather][org.jetbrains.kotlinx.dataframe.DataFrame.gather], and [DataFrame.fillNulls][org.jetbrains.kotlinx.dataframe.DataFrame.fillNulls]) + * can be done in the following ways: + * ### 1. [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.Dsl.WithExample] + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * #### NOTE: There's also a 'single column' variant used sometimes: [Column Selection DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.DslSingle.WithExample]. + * ### 2. [Column names][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnNames.WithExample] + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]`("length", "age")` + * + * ### 3. [Column references][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnAccessors.WithExample] + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]`(length, age)` + * + * ### 4. [KProperties][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.KProperties.WithExample] + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]`(Person::length, Person::age)` + * + */ + interface FillNaNsSelectingOptions +} + +/** + * ## The Fill NaNs Operation + * + * Replaces [`NaN`][org.jetbrains.kotlinx.dataframe.documentation.NaN] values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNaNs.Grammar] + * + * For more information: [See `fillNaNs` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillnans) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNaNs.FillNaNsSelectingOptions] + * for all the selecting options. + * + * ### This Fill NaNs Overload + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * @param [columns] The [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNaNs(columns: ColumnsSelector): Update = + update(columns).where { it.isNaN } + +/** + * ## The Fill NaNs Operation + * + * Replaces [`NaN`][org.jetbrains.kotlinx.dataframe.documentation.NaN] values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNaNs.Grammar] + * + * For more information: [See `fillNaNs` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillnans) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNaNs.FillNaNsSelectingOptions] + * for all the selecting options. + * + * ### This Fill NaNs Overload + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]`("length", "age")` + * + * @param [columns] The [Strings][String] corresponding to the names of columns belonging to this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNaNs(vararg columns: String): Update = fillNaNs { columns.toColumnSet() } + +/** + * ## The Fill NaNs Operation + * + * Replaces [`NaN`][org.jetbrains.kotlinx.dataframe.documentation.NaN] values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNaNs.Grammar] + * + * For more information: [See `fillNaNs` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillnans) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNaNs.FillNaNsSelectingOptions] + * for all the selecting options. + * + * ### This Fill NaNs Overload + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]`(Person::length, Person::age)` + * + * @param [columns] The [KProperties][KProperty] corresponding to columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNaNs(vararg columns: KProperty): Update = fillNaNs { columns.toColumnSet() } + +/** + * ## The Fill NaNs Operation + * + * Replaces [`NaN`][org.jetbrains.kotlinx.dataframe.documentation.NaN] values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNaNs.Grammar] + * + * For more information: [See `fillNaNs` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillnans) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNaNs.FillNaNsSelectingOptions] + * for all the selecting options. + * + * ### This Fill NaNs Overload + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[fillNaNs][org.jetbrains.kotlinx.dataframe.api.fillNaNs]`(length, age)` + * + * @param [columns] The [Column References][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNaNs(vararg columns: ColumnReference): Update = + fillNaNs { columns.toColumnSet() } + +// endregion + +// region fillNA + +/** + * ## The Fill NA Operation + * + * Replaces [`NA`][NA] values with given value or expression. + * Specific case of [update]. + * + * ### Check out: [Grammar][FillNA.Grammar] + * + * For more information: [See `fillNA` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillna) + */ +internal interface FillNA { + + /** ## [fillNA][fillNA] Operation Grammar + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + * + *      + * + * + * [fillNA][fillNA]**` { `**[`columns`][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns]**` }`** + * + *      + * `[ `__`.`__[**`where`**][org.jetbrains.kotlinx.dataframe.api.Update.where]**` { `**[`rowValueCondition`][org.jetbrains.kotlinx.dataframe.documentation.SelectingRows.RowValueCondition.WithExample]**` } `**`]` + * + *      + * `[ `__`.`__[**`at`**][org.jetbrains.kotlinx.dataframe.api.Update.at]**`(`**[`rowIndices`][org.jetbrains.kotlinx.dataframe.api.CommonUpdateAtFunctionDoc.RowIndicesParam]**`)`**` ]` + * + *      + * __`.`__[**`with`**][org.jetbrains.kotlinx.dataframe.api.Update.with]**` { `**[`rowExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowValueExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`notNull`**][org.jetbrains.kotlinx.dataframe.api.Update.notNull]**` { `**[`rowExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowValueExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`perCol`**][org.jetbrains.kotlinx.dataframe.api.Update.perCol]**` { `**[`colExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenColumn.ColumnExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`perRowCol`**][org.jetbrains.kotlinx.dataframe.api.Update.perRowCol]**` { `**[`rowColExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRowAndColumn.RowColumnExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`withNull`**][org.jetbrains.kotlinx.dataframe.api.Update.withNull]**`()`** + * + *      + * `| `__`.`__[**`withZero`**][org.jetbrains.kotlinx.dataframe.api.Update.withZero]**`()`** + * + *      + * `| `__`.`__[**`asFrame`**][org.jetbrains.kotlinx.dataframe.api.Update.asFrame]**` { `**[`dataFrameExpression`][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenDataFrame.DataFrameExpression.WithExample]**` }`** + * + */ + interface Grammar + + /** + * + * ## Selecting Columns + * Selecting columns for various operations (including but not limited to + * [DataFrame.select][org.jetbrains.kotlinx.dataframe.DataFrame.select], [DataFrame.update][org.jetbrains.kotlinx.dataframe.DataFrame.update], [DataFrame.gather][org.jetbrains.kotlinx.dataframe.DataFrame.gather], and [DataFrame.fillNulls][org.jetbrains.kotlinx.dataframe.DataFrame.fillNulls]) + * can be done in the following ways: + * ### 1. [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.Dsl.WithExample] + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * #### NOTE: There's also a 'single column' variant used sometimes: [Column Selection DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.DslSingle.WithExample]. + * ### 2. [Column names][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnNames.WithExample] + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]`("length", "age")` + * + * ### 3. [Column references][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnAccessors.WithExample] + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]`(length, age)` + * + * ### 4. [KProperties][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.KProperties.WithExample] + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]`(Person::length, Person::age)` + * + */ + interface FillNASelectingOptions +} + +/** + * ## The Fill NA Operation + * + * Replaces [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA] values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNA.Grammar] + * + * For more information: [See `fillNA` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillna) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNA.FillNASelectingOptions] + * for all the selecting options. + * + * ### This Fill NA Overload + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * @param [columns] The [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNA(columns: ColumnsSelector): Update = + update(columns).where { it.isNA } + +/** + * ## The Fill NA Operation + * + * Replaces [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA] values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNA.Grammar] + * + * For more information: [See `fillNA` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillna) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNA.FillNASelectingOptions] + * for all the selecting options. + * + * ### This Fill NA Overload + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]`("length", "age")` + * + * @param [columns] The [Strings][String] corresponding to the names of columns belonging to this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNA(vararg columns: String): Update = fillNA { columns.toColumnSet() } + +/** + * ## The Fill NA Operation + * + * Replaces [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA] values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNA.Grammar] + * + * For more information: [See `fillNA` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillna) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNA.FillNASelectingOptions] + * for all the selecting options. + * + * ### This Fill NA Overload + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]`(Person::length, Person::age)` + * + * @param [columns] The [KProperties][KProperty] corresponding to columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNA(vararg columns: KProperty): Update = fillNA { columns.toColumnSet() } + +/** + * ## The Fill NA Operation + * + * Replaces [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA] values with given value or expression. + * Specific case of [update][org.jetbrains.kotlinx.dataframe.api.update]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FillNA.Grammar] + * + * For more information: [See `fillNA` on the documentation website.](https://kotlin.github.io/dataframe/fill.html#fillna) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.FillNA.FillNASelectingOptions] + * for all the selecting options. + * + * ### This Fill NA Overload + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[fillNA][org.jetbrains.kotlinx.dataframe.api.fillNA]`(length, age)` + * + * @param [columns] The [Column References][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.fillNA(vararg columns: ColumnReference): Update = + fillNA { columns.toColumnSet() } + +// endregion + +// region dropNulls + +/** + * ## The Drop Nulls Operation + * + * Removes rows with `null` values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNulls.DropNullsSelectingOptions]). + * + * Also, you can supply `whereAllNull = true` to only drop rows where all selected cells are `null`. By default, + * rows are dropped if any of the selected cells are `null`. + * + * For more information: [See `dropNulls` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropnulls) + * ### This Drop Nulls Overload + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[dropNulls][org.jetbrains.kotlinx.dataframe.api.dropNulls]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[dropNulls][org.jetbrains.kotlinx.dataframe.api.dropNulls]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[dropNulls][org.jetbrains.kotlinx.dataframe.api.dropNulls]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * `df.`[dropNulls][dropNulls]`(whereAllNull = true) { `[colsOf][colsOf]`<`[Double][Double]`>() }` + * @param whereAllNull `false` by default. + * If `true`, rows are dropped if all selected cells are `null`. + * If `false`, rows are dropped if any of the selected cells is `null`. + * @param columns The [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +@Refine +@Interpretable("DropNulls0") +public fun DataFrame.dropNulls(whereAllNull: Boolean = false, columns: ColumnsSelector): DataFrame { + val cols = this[columns] + return if (whereAllNull) { + drop { row -> cols.all { col -> col[row] == null } } + } else { + drop { row -> cols.any { col -> col[row] == null } } + } +} + +/** + * ## The Drop Nulls Operation + * + * Removes rows with `null` values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNulls.DropNullsSelectingOptions]). + * + * Also, you can supply `whereAllNull = true` to only drop rows where all selected cells are `null`. By default, + * rows are dropped if any of the selected cells are `null`. + * + * For more information: [See `dropNulls` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropnulls) + * ### This Drop Nulls Overload + * This overload operates on all columns in the [DataFrame]. + * @param whereAllNull `false` by default. + * If `true`, rows are dropped if all selected cells are `null`. + * If `false`, rows are dropped if any of the selected cells is `null`. + */ +public fun DataFrame.dropNulls(whereAllNull: Boolean = false): DataFrame = dropNulls(whereAllNull) { all() } + +/** + * ## The Drop Nulls Operation + * + * Removes rows with `null` values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNulls.DropNullsSelectingOptions]). + * + * Also, you can supply `whereAllNull = true` to only drop rows where all selected cells are `null`. By default, + * rows are dropped if any of the selected cells are `null`. + * + * For more information: [See `dropNulls` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropnulls) + * ### This Drop Nulls Overload + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[dropNulls][org.jetbrains.kotlinx.dataframe.api.dropNulls]`(Person::length, Person::age)` + * + * `df.`[dropNulls][dropNulls]`(Person::length, whereAllNull = true)` + * @param whereAllNull `false` by default. + * If `true`, rows are dropped if all selected cells are `null`. + * If `false`, rows are dropped if any of the selected cells is `null`. + * @param columns The [KProperties][KProperty] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNulls(vararg columns: KProperty<*>, whereAllNull: Boolean = false): DataFrame = + dropNulls(whereAllNull) { columns.toColumnSet() } + +/** + * ## The Drop Nulls Operation + * + * Removes rows with `null` values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNulls.DropNullsSelectingOptions]). + * + * Also, you can supply `whereAllNull = true` to only drop rows where all selected cells are `null`. By default, + * rows are dropped if any of the selected cells are `null`. + * + * For more information: [See `dropNulls` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropnulls) + * ### This Drop Nulls Overload + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[dropNulls][org.jetbrains.kotlinx.dataframe.api.dropNulls]`("length", "age")` + * + * `df.`[dropNulls][dropNulls]`("length", whereAllNull = true)` + * @param whereAllNull `false` by default. + * If `true`, rows are dropped if all selected cells are `null`. + * If `false`, rows are dropped if any of the selected cells is `null`. + * @param columns The [Strings][String] corresponding to the names of columns in this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNulls(vararg columns: String, whereAllNull: Boolean = false): DataFrame = + dropNulls(whereAllNull) { columns.toColumnSet() } + +/** + * ## The Drop Nulls Operation + * + * Removes rows with `null` values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNulls.DropNullsSelectingOptions]). + * + * Also, you can supply `whereAllNull = true` to only drop rows where all selected cells are `null`. By default, + * rows are dropped if any of the selected cells are `null`. + * + * For more information: [See `dropNulls` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropnulls) + * ### This Drop Nulls Overload + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[dropNulls][org.jetbrains.kotlinx.dataframe.api.dropNulls]`(length, age)` + * + * `df.`[dropNulls][dropNulls]`(length, whereAllNull = true)` + * @param whereAllNull `false` by default. + * If `true`, rows are dropped if all selected cells are `null`. + * If `false`, rows are dropped if any of the selected cells is `null`. + * @param columns The [Column References][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNulls(vararg columns: AnyColumnReference, whereAllNull: Boolean = false): DataFrame = + dropNulls(whereAllNull) { columns.toColumnSet() } + +/** + * ## The Drop Nulls Operation + * + * Removes `null` values from this [DataColumn], adjusting the type accordingly. + */ +public fun DataColumn.dropNulls(): DataColumn = + (if (!hasNulls()) this else filter { it != null }) as DataColumn + +// endregion + +// region dropNA + +/** + * ## The Drop `NA` Operation + * + * Removes rows with [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA] values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNA.DropNASelectingOptions]). + * Also, you can supply `whereAllNA = true` to only drop rows where all selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. By default, + * rows are dropped if any of the selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * + * For more information: [See `dropNA` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropna) + * ### This Drop NA Overload + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[dropNA][org.jetbrains.kotlinx.dataframe.api.dropNA]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[dropNA][org.jetbrains.kotlinx.dataframe.api.dropNA]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[dropNA][org.jetbrains.kotlinx.dataframe.api.dropNA]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * `df.`[dropNA][dropNA]`(whereAllNA = true) { `[colsOf][colsOf]`<`[Double][Double]`>() }` + * @param whereAllNA `false` by default. + * If `true`, rows are dropped if all selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * If `false`, rows are dropped if any of the selected cells is [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * @param columns The [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNA(whereAllNA: Boolean = false, columns: ColumnsSelector): DataFrame { + val cols = this[columns] + return if (whereAllNA) { + drop { cols.all { this[it].isNA } } + } else { + drop { cols.any { this[it].isNA } } + } +} + +/** + * ## The Drop `NA` Operation + * + * Removes rows with [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA] values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNA.DropNASelectingOptions]). + * Also, you can supply `whereAllNA = true` to only drop rows where all selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. By default, + * rows are dropped if any of the selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * + * For more information: [See `dropNA` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropna) + * ### This Drop NA Overload + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[dropNA][org.jetbrains.kotlinx.dataframe.api.dropNA]`(Person::length, Person::age)` + * + * `df.`[dropNA][dropNA]`(Person::length, whereAllNA = true)` + * @param whereAllNA `false` by default. + * If `true`, rows are dropped if all selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * If `false`, rows are dropped if any of the selected cells is [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * @param columns The [KProperties][KProperty] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNA(vararg columns: KProperty<*>, whereAllNA: Boolean = false): DataFrame = + dropNA(whereAllNA) { columns.toColumnSet() } + +/** + * ## The Drop `NA` Operation + * + * Removes rows with [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA] values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNA.DropNASelectingOptions]). + * Also, you can supply `whereAllNA = true` to only drop rows where all selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. By default, + * rows are dropped if any of the selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * + * For more information: [See `dropNA` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropna) + * ### This Drop NA Overload + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[dropNA][org.jetbrains.kotlinx.dataframe.api.dropNA]`("length", "age")` + * + * `df.`[dropNA][dropNA]`("length", whereAllNA = true)` + * @param whereAllNA `false` by default. + * If `true`, rows are dropped if all selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * If `false`, rows are dropped if any of the selected cells is [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * @param columns The [Strings][String] corresponding to the names of columns in this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNA(vararg columns: String, whereAllNA: Boolean = false): DataFrame = + dropNA(whereAllNA) { columns.toColumnSet() } + +/** + * ## The Drop `NA` Operation + * + * Removes rows with [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA] values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNA.DropNASelectingOptions]). + * Also, you can supply `whereAllNA = true` to only drop rows where all selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. By default, + * rows are dropped if any of the selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * + * For more information: [See `dropNA` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropna) + * ### This Drop NA Overload + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[dropNA][org.jetbrains.kotlinx.dataframe.api.dropNA]`(length, age)` + * + * `df.`[dropNA][dropNA]`(length, whereAllNA = true)` + * @param whereAllNA `false` by default. + * If `true`, rows are dropped if all selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * If `false`, rows are dropped if any of the selected cells is [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * @param columns The [Column References][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNA(vararg columns: AnyColumnReference, whereAllNA: Boolean = false): DataFrame = + dropNA(whereAllNA) { columns.toColumnSet() } + +/** + * ## The Drop `NA` Operation + * + * Removes rows with [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA] values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNA.DropNASelectingOptions]). + * Also, you can supply `whereAllNA = true` to only drop rows where all selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. By default, + * rows are dropped if any of the selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * + * For more information: [See `dropNA` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropna) + * ### This Drop NA Overload + * This overload operates on all columns in the [DataFrame]. + * @param whereAllNA `false` by default. + * If `true`, rows are dropped if all selected cells are [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + * If `false`, rows are dropped if any of the selected cells is [`NA`][org.jetbrains.kotlinx.dataframe.documentation.NA]. + */ +public fun DataFrame.dropNA(whereAllNA: Boolean = false): DataFrame = dropNA(whereAllNA) { all() } + +/** + * ## The Drop `NA` Operation + * + * Removes [`NA`][NA] values from this [DataColumn], adjusting the type accordingly. + */ +public fun DataColumn.dropNA(): DataColumn = + when (typeClass) { + Double::class, Float::class -> filter { !it.isNA }.cast() + else -> (if (!hasNulls()) this else filter { it != null }) as DataColumn + } + +// endregion + +// region dropNaNs + +/** + * ## The Drop `NaN` Operation + * + * Removes rows with [`NaN`][Double.isNaN] values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNaNs.DropNaNsSelectingOptions]). + * Also, you can supply `whereAllNaN = true` to only drop rows where all selected cells are [`NaN`][Double.isNaN]. By default, + * rows are dropped if any of the selected cells are [`NaN`][Double.isNaN]. + * + * For more information: [See `dropNaNs` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropnans) + * ### This Drop NaNs Overload + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[dropNaNs][org.jetbrains.kotlinx.dataframe.api.dropNaNs]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[dropNaNs][org.jetbrains.kotlinx.dataframe.api.dropNaNs]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[dropNaNs][org.jetbrains.kotlinx.dataframe.api.dropNaNs]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * `df.`[dropNaNs][dropNaNs]`(whereAllNaN = true) { `[colsOf][colsOf]`<`[Double][Double]`>() }` + * @param whereAllNaN `false` by default. + * If `true`, rows are dropped if all selected cells are [`NaN`][Double.isNaN]. + * If `false`, rows are dropped if any of the selected cells is [`NaN`][Double.isNaN]. + * @param columns The [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNaNs(whereAllNaN: Boolean = false, columns: ColumnsSelector): DataFrame { + val cols = this[columns] + return if (whereAllNaN) { + drop { cols.all { this[it].isNaN } } + } else { + drop { cols.any { this[it].isNaN } } + } +} + +/** + * ## The Drop `NaN` Operation + * + * Removes rows with [`NaN`][Double.isNaN] values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNaNs.DropNaNsSelectingOptions]). + * Also, you can supply `whereAllNaN = true` to only drop rows where all selected cells are [`NaN`][Double.isNaN]. By default, + * rows are dropped if any of the selected cells are [`NaN`][Double.isNaN]. + * + * For more information: [See `dropNaNs` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropnans) + * ### This Drop NaNs Overload + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[dropNaNs][org.jetbrains.kotlinx.dataframe.api.dropNaNs]`(Person::length, Person::age)` + * + * `df.`[dropNaNs][dropNaNs]`(Person::length, whereAllNaN = true)` + * @param whereAllNaN `false` by default. + * If `true`, rows are dropped if all selected cells are [`NaN`][Double.isNaN]. + * If `false`, rows are dropped if any of the selected cells is [`NaN`][Double.isNaN]. + * @param columns The [KProperties][KProperty] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNaNs(vararg columns: KProperty<*>, whereAllNaN: Boolean = false): DataFrame = + dropNaNs(whereAllNaN) { columns.toColumnSet() } + +/** + * ## The Drop `NaN` Operation + * + * Removes rows with [`NaN`][Double.isNaN] values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNaNs.DropNaNsSelectingOptions]). + * Also, you can supply `whereAllNaN = true` to only drop rows where all selected cells are [`NaN`][Double.isNaN]. By default, + * rows are dropped if any of the selected cells are [`NaN`][Double.isNaN]. + * + * For more information: [See `dropNaNs` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropnans) + * ### This Drop NaNs Overload + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[dropNaNs][org.jetbrains.kotlinx.dataframe.api.dropNaNs]`("length", "age")` + * + * `df.`[dropNaNs][dropNaNs]`("length", whereAllNaN = true)` + * @param whereAllNaN `false` by default. + * If `true`, rows are dropped if all selected cells are [`NaN`][Double.isNaN]. + * If `false`, rows are dropped if any of the selected cells is [`NaN`][Double.isNaN]. + * @param columns The [Strings][String] corresponding to the names of columns in this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNaNs(vararg columns: String, whereAllNaN: Boolean = false): DataFrame = + dropNaNs(whereAllNaN) { columns.toColumnSet() } + +/** + * ## The Drop `NaN` Operation + * + * Removes rows with [`NaN`][Double.isNaN] values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNaNs.DropNaNsSelectingOptions]). + * Also, you can supply `whereAllNaN = true` to only drop rows where all selected cells are [`NaN`][Double.isNaN]. By default, + * rows are dropped if any of the selected cells are [`NaN`][Double.isNaN]. + * + * For more information: [See `dropNaNs` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropnans) + * ### This Drop NaNs Overload + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[dropNaNs][org.jetbrains.kotlinx.dataframe.api.dropNaNs]`(length, age)` + * + * `df.`[dropNaNs][dropNaNs]`(length, whereAllNaN = true)` + * @param whereAllNaN `false` by default. + * If `true`, rows are dropped if all selected cells are [`NaN`][Double.isNaN]. + * If `false`, rows are dropped if any of the selected cells is [`NaN`][Double.isNaN]. + * @param columns The [Column References][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to drop rows in. + */ +public fun DataFrame.dropNaNs(vararg columns: AnyColumnReference, whereAllNaN: Boolean = false): DataFrame = + dropNaNs(whereAllNaN) { columns.toColumnSet() } + +/** + * ## The Drop `NaN` Operation + * + * Removes rows with [`NaN`][Double.isNaN] values. Specific case of [drop][org.jetbrains.kotlinx.dataframe.DataFrame.drop]. + * + * Optionally, you can select which columns to operate on (see [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.DropNaNs.DropNaNsSelectingOptions]). + * Also, you can supply `whereAllNaN = true` to only drop rows where all selected cells are [`NaN`][Double.isNaN]. By default, + * rows are dropped if any of the selected cells are [`NaN`][Double.isNaN]. + * + * For more information: [See `dropNaNs` on the documentation website.](https://kotlin.github.io/dataframe/drop.html#dropnans) + * ### This Drop NaNs Overload + * This overload operates on all columns in the [DataFrame]. + * @param whereAllNaN `false` by default. + * If `true`, rows are dropped if all selected cells are [`NaN`][Double.isNaN]. + * If `false`, rows are dropped if any of the selected cells is [`NaN`][Double.isNaN]. + */ +public fun DataFrame.dropNaNs(whereAllNaN: Boolean = false): DataFrame = dropNaNs(whereAllNaN) { all() } + +/** + * ## The Drop `NaN` Operation + * + * Removes [`NaN`][NaN] values from this [DataColumn], adjusting the type accordingly. + */ +public fun DataColumn.dropNaNs(): DataColumn = + when (typeClass) { + Double::class, Float::class -> filter { !it.isNaN }.cast() + else -> this + } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/TypeConversions.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/TypeConversions.kt new file mode 100644 index 000000000..a6ff75634 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/TypeConversions.kt @@ -0,0 +1,413 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyBaseCol +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnGroupAccessor +import org.jetbrains.kotlinx.dataframe.ColumnSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.ValueColumn +import org.jetbrains.kotlinx.dataframe.impl.GroupByImpl +import org.jetbrains.kotlinx.dataframe.impl.anyNull +import org.jetbrains.kotlinx.dataframe.impl.asList +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnAccessorImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.asAnyFrameColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.asValues +import org.jetbrains.kotlinx.dataframe.impl.columns.forceResolve +import org.jetbrains.kotlinx.dataframe.impl.owner +import org.jetbrains.kotlinx.dataframe.index +import kotlin.reflect.KProperty +import kotlin.reflect.typeOf + +// region String + +public fun String.toColumnAccessor(): ColumnAccessor = ColumnAccessorImpl(this) + +public fun String.toColumnOf(): ColumnAccessor = ColumnAccessorImpl(this) + +// endregion + +// region ColumnPath + +public fun ColumnPath.toColumnOf(): ColumnAccessor = ColumnAccessorImpl(this) + +public fun ColumnPath.toColumnAccessor(): ColumnAccessor = ColumnAccessorImpl(this) + +public fun ColumnPath.toColumnGroupAccessor(): ColumnAccessor = ColumnAccessorImpl(this) + +public fun ColumnPath.toFrameColumnAccessor(): ColumnAccessor = ColumnAccessorImpl(this) + +// endregion + +// region ColumnReference + +public fun ColumnReference.toColumnAccessor(): ColumnAccessor = + when (this) { + is ColumnAccessor -> this + else -> ColumnAccessorImpl(path()) + } + +// endregion + +// region KProperty + +public fun KProperty.toColumnAccessor(): ColumnAccessor = ColumnAccessorImpl(columnName) + +// endregion + +// region DataColumn + +public fun AnyBaseCol.toDataFrame(): AnyFrame = dataFrameOf(listOf(this)) + +@JvmName("asNumberAnyNullable") +public fun DataColumn.asNumbers(): ValueColumn { + require(isNumber()) + return this.asValues() +} + +@JvmName("asNumberAny") +public fun DataColumn.asNumbers(): ValueColumn { + require(isNumber()) + return this as ValueColumn +} + +public fun DataColumn.asComparable(): DataColumn> { + require(isComparable()) + return this as DataColumn> +} + +public fun ColumnReference.castToNotNullable(): ColumnReference = cast() + +public fun DataColumn.castToNotNullable(): DataColumn { + require(!hasNulls()) { "Column `$name` has nulls" } + return this as DataColumn +} + +public fun DataColumn.castToNullable(): DataColumn = cast() + +public fun ColumnReference.castToNullable(): ColumnReference = cast() + +public fun AnyCol.setNullable(nullable: Boolean): AnyCol = + if (nullable) { + this.castToNullable() + } else { + this.castToNotNullable() + } + +// region to array + +public inline fun DataColumn.toTypedArray(): Array = toList().toTypedArray() + +public fun DataColumn.toFloatArray(): FloatArray = convertToFloat().toList().toFloatArray() + +public fun DataColumn.toDoubleArray(): DoubleArray = convertToDouble().toList().toDoubleArray() + +public fun DataColumn.toIntArray(): IntArray = convertToInt().toList().toIntArray() + +public fun DataColumn.toLongArray(): LongArray = convertToLong().toList().toLongArray() + +public fun DataColumn.toShortArray(): ShortArray = convertTo().toList().toShortArray() + +public fun DataColumn.toByteArray(): ByteArray = convertTo().toList().toByteArray() + +// endregion + +public fun AnyCol.asValueColumn(): ValueColumn<*> = this as ValueColumn<*> + +@JvmName("asColumnGroupUntyped") +public fun AnyCol.asColumnGroup(): ColumnGroup<*> = this as ColumnGroup<*> + +@JvmName("asFrameColumnUntyped") +public fun AnyCol.asFrameColumn(): FrameColumn<*> = this as FrameColumn<*> + +public fun DataColumn>.asFrameColumn(): FrameColumn = + (this as AnyCol).asAnyFrameColumn().castFrameColumn() + +@JvmName("asGroupedT") +public fun DataColumn>.asColumnGroup(): ColumnGroup = (this as AnyCol).asColumnGroup().cast() + +public fun DataColumn>.asDataFrame(): DataFrame = asColumnGroup() + +// endregion + +// region ColumnGroup + +public fun ColumnGroup.asDataColumn(): DataColumn> = this as DataColumn> + +public fun ColumnGroup.asDataFrame(): DataFrame = this + +// endregion + +// region SingleColumn + +/** + * ## As ColumnGroup + * + * Creates a [ColumnAccessor][ColumnAccessor]`<`[DataRow][DataRow]`<`[C][C]`>>` from [this][this]. + * This is especially useful when you want to use [ColumnGroup] functions in the [ColumnsSelectionDsl] but your column + * type is not recognized as a [ColumnGroup]. + * If you're not sure whether a column is recognized as [ColumnGroup] or not, you can always call [asColumnGroup][asColumnGroup] + * and it will return the same type if it is already a [ColumnGroup]. + * + * NOTE: This does not check whether the column is actually a [ColumnGroup] or not. It just casts it. + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { `[first][ColumnsSelectionDsl.first]`().`[asColumnGroup][SingleColumn.asColumnGroup]`().`[firstCol][ColumnsSelectionDsl.firstCol]`() }` + * + * @receiver The column reference to cast to a [SingleColumn]`<`[DataRow][DataRow]`<`[C][C]`>>`. + * @param [C] The type of the (group) column. + * @return A [SingleColumn]`<`[DataRow][DataRow]`<`[C][C]`>>`. + */ +private interface SingleColumnAsColumnGroupDocs + +/** ## As ColumnGroup + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]`<`[DataRow][org.jetbrains.kotlinx.dataframe.DataRow]`<`[C][C]`>>` from [this][this]. + * This is especially useful when you want to use [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] functions in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] but your column + * type is not recognized as a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * If you're not sure whether a column is recognized as [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or not, you can always call [asColumnGroup][asColumnGroup] + * and it will return the same type if it is already a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * NOTE: This does not check whether the column is actually a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or not. It just casts it. + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]`().`[asColumnGroup][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.asColumnGroup]`().`[firstCol][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.firstCol]`() }` + * + * @receiver The column reference to cast to a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[DataRow][org.jetbrains.kotlinx.dataframe.DataRow]`<`[C][C]`>>`. + * @param [C] The type of the (group) column. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[DataRow][org.jetbrains.kotlinx.dataframe.DataRow]`<`[C][C]`>>`. */ +@Suppress("UNCHECKED_CAST") +public fun SingleColumn.asColumnGroup(): SingleColumn> = this as SingleColumn> + +/** ## As ColumnGroup + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]`<`[DataRow][org.jetbrains.kotlinx.dataframe.DataRow]`<`[C][C]`>>` from [this][this]. + * This is especially useful when you want to use [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] functions in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] but your column + * type is not recognized as a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * If you're not sure whether a column is recognized as [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or not, you can always call [asColumnGroup][asColumnGroup] + * and it will return the same type if it is already a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * NOTE: This does not check whether the column is actually a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or not. It just casts it. + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]`().`[asColumnGroup][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.asColumnGroup]`().`[firstCol][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.firstCol]`() }` + * + * @receiver The column reference to cast to a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[DataRow][org.jetbrains.kotlinx.dataframe.DataRow]`<`[C][C]`>>`. + * @param [C] The type of the (group) column. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[DataRow][org.jetbrains.kotlinx.dataframe.DataRow]`<`[C][C]`>>`. */ +@JvmName("asColumnGroupDataRow") +public fun SingleColumn>.asColumnGroup(): SingleColumn> = this + +// endregion + +// region FrameColumn + +public fun FrameColumn.asDataColumn(): DataColumn?> = this + +public fun FrameColumn.toValueColumn(): ValueColumn?> = + DataColumn.createValueColumn(name, toList(), type()) + +// endregion + +// region ColumnSet + +@JvmName("asNumbersAny") +public fun ColumnSet.asNumbers(): ColumnSet = this as ColumnSet + +@JvmName("asNumbersAny") +public fun SingleColumn.asNumbers(): SingleColumn = this as SingleColumn + +@JvmName("asNumbersAnyNullable") +public fun ColumnSet.asNumbers(): ColumnSet = this as ColumnSet + +@JvmName("asNumbersAnyNullable") +public fun SingleColumn.asNumbers(): SingleColumn = this as SingleColumn + +public fun ColumnSet.asComparable(): ColumnSet> = this as ColumnSet> + +public fun SingleColumn.asComparable(): SingleColumn> = this as SingleColumn> + +// endregion + +// region Iterable + +public fun Iterable>.toFrameColumn(name: String = ""): FrameColumn = + DataColumn.createFrameColumn(name, asList()).forceResolve() + +public inline fun Iterable.toValueColumn(name: String = ""): ValueColumn = + DataColumn.createValueColumn(name, asList()).forceResolve() + +public inline fun Iterable.toValueColumn(column: ColumnAccessor): ValueColumn = + toValueColumn(column.name()) + +public inline fun Iterable.toValueColumn(column: KProperty): ValueColumn = + toValueColumn(column.columnName) + +/** + * Indicates how [DataColumn.type] should be calculated. + * + * Used in [add], [insert], [convert], [map], [merge], [split] and other [DataFrame] operations + */ +public enum class Infer { + + /** + * Use reified type argument of an inline [DataFrame] operation as [DataColumn.type]. + */ + None, + + /** + * Use reified type argument of an inline [DataFrame] operation as [DataColumn.type], but compute [DataColumn.hasNulls] by checking column [DataColumn.values] for an actual presence of *null* values. + */ + Nulls, + + /** + * Infer [DataColumn.type] and [DataColumn.hasNulls] from actual [DataColumn.values] using optionally provided base type as an upper bound. + */ + Type, + + ; + + /** + * @param [infer] [An enum][Infer] that indicates how [DataColumn.type] should be calculated. + * Either [None], [Nulls], or [Type]. + */ + internal interface ParamDoc +} + +/** + * Indicates how [DataColumn.hasNulls] (or, more accurately, DataColumn.type.isMarkedNullable) should be initialized from + * expected schema and actual data when reading schema-defined data formats. + */ +public enum class NullabilityOptions { + /** + * Use only actual data, set [DataColumn.hasNulls] to true if and only if there are null values in the column. + * On empty dataset use False. + */ + Infer, + + /** + * Set [DataColumn.hasNulls] to expected value. Throw exception if column should be not nullable but there are null values. + */ + Checking, + + /** + * Set [DataColumn.hasNulls] to expected value by default. Change False to True if column should be not nullable but there are null values. + */ + Widening, +} + +public class NullabilityException : Exception() + +/** + * @return if column should be marked nullable for current [NullabilityOptions] value with actual [data] and [expectedNulls] per some schema/signature. + * @throws [NullabilityException] for [NullabilityOptions.Checking] if [expectedNulls] is false and [data] contains nulls. + */ +public fun NullabilityOptions.applyNullability(data: List, expectedNulls: Boolean): Boolean { + val hasNulls = data.anyNull() + return when (this) { + NullabilityOptions.Infer -> hasNulls + + NullabilityOptions.Checking -> { + if (!expectedNulls && hasNulls) { + throw NullabilityException() + } + expectedNulls + } + + NullabilityOptions.Widening -> { + expectedNulls || hasNulls + } + } +} + +public inline fun Iterable.toColumn(name: String = "", infer: Infer = Infer.Nulls): DataColumn = + if (infer == Infer.Type) { + DataColumn.createWithTypeInference(name, asList()) + } else { + DataColumn.create(name, asList(), typeOf(), infer) + }.forceResolve() + +public inline fun Iterable<*>.toColumnOf(name: String = ""): DataColumn = + DataColumn.create(name, asList() as List, typeOf()).forceResolve() + +public inline fun Iterable.toColumn(ref: ColumnReference): DataColumn = + DataColumn.create(ref.name(), asList()).forceResolve() + +public inline fun Iterable.toColumn(property: KProperty): DataColumn = + DataColumn.create(property.columnName, asList()).forceResolve() + +public fun Iterable.toPath(): ColumnPath = ColumnPath(asList()) + +public fun Iterable.toColumnGroup(name: String): ColumnGroup<*> = dataFrameOf(this).asColumnGroup(name) + +public fun Iterable.toColumnGroup(column: ColumnGroupAccessor): ColumnGroup = + dataFrameOf(this).cast().asColumnGroup(column) + +public fun Iterable.toColumnGroupOf(name: String): ColumnGroup = toColumnGroup(name).cast() + +// endregion + +// region DataFrame + +public fun AnyFrame.toMap(): Map> = columns().associateBy({ it.name }, { it.toList() }) + +public fun DataFrame.asColumnGroup(name: String = ""): ColumnGroup = + when (this) { + is ColumnGroup -> rename(name) + else -> DataColumn.createColumnGroup(name, this) + } + +public fun DataFrame.asColumnGroup(column: ColumnGroupAccessor): ColumnGroup = asColumnGroup(column.name) + +// region as GroupedDataFrame + +public fun DataFrame.asGroupBy(groupedColumnName: String): GroupBy = + GroupByImpl(this, getFrameColumn(groupedColumnName).castFrameColumn()) { none() } + +public fun DataFrame.asGroupBy(groupedColumn: ColumnReference>): GroupBy = + GroupByImpl(this, getFrameColumn(groupedColumn.name()).castFrameColumn()) { none() } + +public fun DataFrame.asGroupBy(): GroupBy { + val groupCol = columns().single { it.isFrameColumn() }.asAnyFrameColumn().castFrameColumn() + return asGroupBy { groupCol } +} + +public fun DataFrame.asGroupBy(selector: ColumnSelector>): GroupBy { + val column = getColumn(selector).asFrameColumn() + return GroupByImpl(this, column) { none() } +} + +// endregion + +// endregion + +// region DataRow + +public fun DataRow.toDataFrame(): DataFrame = owner[index..index] + +public fun AnyRow.toMap(): Map = df().columns().associate { it.name() to it[index] } + +// endregion + +// region Array + +public inline fun Array.toValueColumn(name: String): ValueColumn = + DataColumn.createValueColumn(name, this.asList(), typeOf()) + +public fun Array.toPath(): ColumnPath = ColumnPath(this.asList()) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/add.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/add.kt new file mode 100644 index 000000000..50cc00d03 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/add.kt @@ -0,0 +1,252 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyBaseCol +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.AnyColumnGroupAccessor +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnsContainer +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.Selector +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.BaseColumn +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.exceptions.DuplicateColumnNamesException +import org.jetbrains.kotlinx.dataframe.exceptions.UnequalColumnSizesException +import org.jetbrains.kotlinx.dataframe.impl.api.insertImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.resolveSingle +import kotlin.reflect.KProperty + +/* + * `add` operation adds new columns to DataFrame. + */ + +// region Add existing columns + +/** + * Creates new [DataFrame] with given columns added to the end of original [DataFrame.columns] list. + * + * Original [DataFrame] is not modified. + * + * @param columns columns to add + * @throws [DuplicateColumnNamesException] if columns in expected result have repeated names + * @throws [UnequalColumnSizesException] if columns in expected result have different sizes + * @return new [DataFrame] with added columns + */ +public fun DataFrame.add(vararg columns: AnyBaseCol): DataFrame = addAll(columns.asIterable()) + +/** + * Creates new [DataFrame] with given columns added to the end of original [DataFrame.columns] list. + * + * Original [DataFrame] is not modified. + * + * @param columns columns to add + * @throws [DuplicateColumnNamesException] if columns in expected result have repeated names + * @throws [UnequalColumnSizesException] if columns in expected result have different sizes + * @return new [DataFrame] with added columns + */ +public fun DataFrame.addAll(columns: Iterable): DataFrame = + dataFrameOf(columns() + columns).cast() + +/** + * Creates new [DataFrame] with all columns from given [dataFrames] added to the end of original [DataFrame.columns] list. + * + * Original [DataFrame] is not modified. + * + * @param dataFrames dataFrames to get columns from + * @throws [DuplicateColumnNamesException] if columns in expected result have repeated names + * @throws [UnequalColumnSizesException] if columns in expected result have different sizes + * @return new [DataFrame] with added columns + */ +public fun DataFrame.add(vararg dataFrames: AnyFrame): DataFrame = addAll(dataFrames.asIterable()) + +/** + * Creates new [DataFrame] with all columns from given [dataFrames] added to the end of original [DataFrame.columns] list. + * + * Original [DataFrame] is not modified. + * + * @param dataFrames dataFrames to get columns from + * @throws [DuplicateColumnNamesException] if columns in expected result have repeated names + * @throws [UnequalColumnSizesException] if columns in expected result have different sizes + * @return new [DataFrame] with added columns + */ +@JvmName("addAllFrames") +public fun DataFrame.addAll(dataFrames: Iterable): DataFrame = + addAll(dataFrames.flatMap { it.columns() }) + +// endregion + +// region Create and add a single column + +/** + * Receiver that is used by the [AddExpression] (for instance in the [add] and [update] operations) + * to access new (added or updated) column value in preceding row. + */ +public interface AddDataRow : DataRow { + + /** + * Returns a new value that was already computed for some preceding row during current [add] or [update] column operation. + * + * Can be used to compute series of values with recurrence relations, e.g. fibonacci. + * + * @throws IndexOutOfBoundsException when called on a successive row that doesn't have new value yet + */ + public fun AnyRow.newValue(): C +} + +/** + * [AddExpression] is used to express or select any instance of `R` using the given instance of [AddDataRow]`` as + * `this` and `it`. + * + * Shorthand for: + * ```kotlin + * AddDataRow.(it: AddDataRow) -> R + * ``` + */ +public typealias AddExpression = Selector, R> + +/** + * Creates new column using row [expression] and adds it to the end of [DataFrame] + * + * Original [DataFrame] is not modified. + * + * @param name name for a new column. If it is empty, a unique column name will be generated. Otherwise, it should be unique for original [DataFrame]. + * @param infer a value of [Infer] that specifies how to compute column [type][BaseColumn.type] for a new column + * @param expression [AddExpression] that computes column value for every [DataRow] + * @return new [DataFrame] with added column + * @throws DuplicateColumnNamesException if [DataFrame] already contains a column with given [name] + */ +@Refine +@Interpretable("Add") +public inline fun DataFrame.add( + name: String, + infer: Infer = Infer.Nulls, + noinline expression: AddExpression, +): DataFrame = (this + mapToColumn(name, infer, expression)) + +public inline fun DataFrame.add( + property: KProperty, + infer: Infer = Infer.Nulls, + noinline expression: AddExpression, +): DataFrame = (this + mapToColumn(property, infer, expression)) + +public inline fun DataFrame.add( + column: ColumnAccessor, + infer: Infer = Infer.Nulls, + noinline expression: AddExpression, +): DataFrame = add(column.path(), infer, expression) + +public inline fun DataFrame.add( + path: ColumnPath, + infer: Infer = Infer.Nulls, + noinline expression: AddExpression, +): DataFrame { + val col = mapToColumn(path.name(), infer, expression) + if (path.size == 1) return this + col + return insertImpl(path, col) +} + +// endregion + +// region Create and add several columns + +public class AddDsl( + @PublishedApi internal val df: DataFrame, +) : ColumnsContainer by df, + ColumnSelectionDsl { + + // TODO: support adding column into path + internal val columns = mutableListOf() + + public fun add(column: AnyColumnReference): Boolean = columns.add(column.resolveSingle(df)!!.data) + + public operator fun AnyColumnReference.unaryPlus(): Boolean = add(this) + + public operator fun String.unaryPlus(): Boolean = add(df[this]) + + @PublishedApi + internal inline fun add( + name: String, + infer: Infer = Infer.Nulls, + noinline expression: RowExpression, + ): Boolean = add(df.mapToColumn(name, infer, expression)) + + public inline fun expr( + infer: Infer = Infer.Nulls, + noinline expression: RowExpression, + ): DataColumn = df.mapToColumn("", infer, expression) + + @Interpretable("From") + public inline infix fun String.from(noinline expression: RowExpression): Boolean = + add(this, Infer.Nulls, expression) + + // TODO: use path instead of name + public inline infix fun ColumnAccessor.from(noinline expression: RowExpression): Boolean = + name().from(expression) + + public inline infix fun KProperty.from(noinline expression: RowExpression): Boolean = + add(name, Infer.Nulls, expression) + + public infix fun String.from(column: AnyColumnReference): Boolean = add(column.rename(this)) + + public inline infix fun ColumnAccessor.from(column: ColumnReference): Boolean = name() from column + + public inline infix fun KProperty.from(column: ColumnReference): Boolean = name from column + + @Interpretable("Into") + public infix fun AnyColumnReference.into(name: String): Boolean = add(rename(name)) + + public infix fun ColumnReference.into(column: ColumnAccessor): Boolean = into(column.name()) + + public infix fun ColumnReference.into(column: KProperty): Boolean = into(column.name) + + @Interpretable("AddDslStringInvoke") + public operator fun String.invoke(body: AddDsl.() -> Unit): Unit = group(this, body) + + public infix fun AnyColumnGroupAccessor.from(body: AddDsl.() -> Unit): Unit = group(this, body) + + public fun group(column: AnyColumnGroupAccessor, body: AddDsl.() -> Unit): Unit = group(column.name(), body) + + public fun group(name: String, body: AddDsl.() -> Unit) { + val dsl = AddDsl(df) + body(dsl) + add(dsl.columns.toColumnGroup(name)) + } + + public fun group(body: AddDsl.() -> Unit): AddGroup = AddGroup(body) + + public infix fun AddGroup.into(groupName: String): Unit = group(groupName, body) + + public infix fun AddGroup.into(column: AnyColumnGroupAccessor): Unit = into(column.name()) +} + +@Refine +@Interpretable("AddWithDsl") +public fun DataFrame.add(body: AddDsl.() -> Unit): DataFrame { + val dsl = AddDsl(this) + body(dsl) + return dataFrameOf(this@add.columns() + dsl.columns).cast() +} + +public inline fun GroupBy.add( + name: String, + infer: Infer = Infer.Nulls, + noinline expression: RowExpression, +): GroupBy = updateGroups { add(name, infer, expression) } + +public inline fun GroupBy.add( + column: ColumnAccessor, + infer: Infer = Infer.Nulls, + noinline expression: RowExpression, +): GroupBy = add(column.name(), infer, expression) + +public class AddGroup(internal val body: AddDsl.() -> Unit) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/addId.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/addId.kt new file mode 100644 index 000000000..d29f697ab --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/addId.kt @@ -0,0 +1,24 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor + +// region DataColumn + +public fun AnyCol.addId(columnName: String = "id"): AnyFrame = toDataFrame().addId(columnName) + +// endregion + +// region DataFrame + +public fun DataFrame.addId(column: ColumnAccessor): DataFrame = insert(column) { index() }.at(0) + +@Refine +@Interpretable("AddId") +public fun DataFrame.addId(columnName: String = "id"): DataFrame = insert(columnName) { index() }.at(0) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/aggregate.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/aggregate.kt new file mode 100644 index 000000000..0c592a431 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/aggregate.kt @@ -0,0 +1,24 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Selector +import org.jetbrains.kotlinx.dataframe.aggregation.AggregateDsl +import org.jetbrains.kotlinx.dataframe.aggregation.AggregateGroupedBody +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.impl.aggregateGroupBy + +// region Pivot + +public fun Pivot.aggregate(separate: Boolean = false, body: Selector, R>): DataRow = + delegate { + aggregate(separate, body) + } + +// endregion + +@Refine +@Interpretable("Aggregate") +public fun Grouped.aggregate(body: AggregateGroupedBody): DataFrame = + aggregateGroupBy((this as GroupBy<*, *>).toDataFrame(), { groups.cast() }, removeColumns = true, body).cast() diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/all.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/all.kt new file mode 100644 index 000000000..465b5b56b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/all.kt @@ -0,0 +1,8141 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.ColumnSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Predicate +import org.jetbrains.kotlinx.dataframe.RowFilter +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.isSingleColumnWithGroup +import org.jetbrains.kotlinx.dataframe.columns.size +import org.jetbrains.kotlinx.dataframe.columns.values +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.addPath +import org.jetbrains.kotlinx.dataframe.impl.columns.onResolve +import org.jetbrains.kotlinx.dataframe.impl.columns.transform +import org.jetbrains.kotlinx.dataframe.impl.owner +import kotlin.reflect.KProperty + +// region DataColumn + +/** Returns `true` if all [values] match the given [predicate] or [values] is empty. */ +public fun DataColumn.all(predicate: Predicate): Boolean = values.all(predicate) + +/** Returns `true` if all [values] are `null` or [values] is empty. */ +public fun DataColumn.allNulls(): Boolean = size == 0 || all { it == null } + +// endregion + +// region DataRow + +public fun AnyRow.allNA(): Boolean = owner.columns().all { it[index()].isNA } + +// endregion + +// region DataFrame + +/** Returns `true` if all [rows] match the given [predicate] or [rows] is empty. */ +public fun DataFrame.all(predicate: RowFilter): Boolean = rows().all { predicate(it, it) } + +// endregion + +// region ColumnsSelectionDsl + +/** + * ## All Flavors of All (Cols) [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + * @param _UNUSED [#KT-68546](https://youtrack.jetbrains.com/issue/KT-68546/Conflicting-overloads-in-non-generic-interface-K2-2.0.0) + */ +public interface AllColumnsSelectionDsl { + + /** + * ## Grammar of All Flavors of All (Cols): + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `colSelector: `[`ColumnSelector`][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`all`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]**`()`** + * + * `| `**`all`**`(`[**`Before`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`|`[**`After`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`|`[**`From`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`|`[**`UpTo`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`) ( `**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`)`**` | `**`{ `**[`colSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSelectorDef]**` }`**` )` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`all`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]**`()`** + * + *     `| `**`.all`**`(`[**`Before`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`|`[**`After`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`|`[**`From`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`|`[**`UpTo`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`) ( `**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`)`**` | `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` )` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`allCols`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]**`()`** + * + *     `| `**`.allCols`**`(`[**`Before`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`|`[**`After`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`|`[**`From`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`|`[**`UpTo`**][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`) ( `**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`)`**` | `**`{ `**[`colSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSelectorDef]**` }`**` )` + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`all`**][ColumnsSelectionDsl.all] */ + public interface PlainDslName + + /** __`.`__[**`all`**][ColumnsSelectionDsl.all] */ + public interface ColumnSetName + + /** __`.`__[**`allCols`**][ColumnsSelectionDsl.allCols] */ + public interface ColumnGroupName + + /** [**`Before`**][ColumnsSelectionDsl.allColsBefore] */ + public interface Before + + /** [**`After`**][ColumnsSelectionDsl.allAfter] */ + public interface After + + /** [**`From`**][ColumnsSelectionDsl.allColsFrom] */ + public interface From + + /** [**`UpTo`**][ColumnsSelectionDsl.allColsUpTo] */ + public interface UpTo + } + + // region all + + /** + * ## All (Cols) + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all columns from [this], + * the opposite of [none][org.jetbrains.kotlinx.dataframe.api.NoneColumnsSelectionDsl.none]. + * + * This makes the function equivalent to [cols()][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] without filter. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `all` is named `allCols` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[move][org.jetbrains.kotlinx.dataframe.DataFrame.move]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() }.`[under][org.jetbrains.kotlinx.dataframe.api.MoveClause.under]`("info")` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroup.`[allCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { "a" in `[name][ColumnWithPath.name]` }.`[all][ColumnSet.all]`() }` + * + *      + * + * NOTE: This is an identity call and can be omitted in most cases. + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @see [ColumnsSelectionDsl.rangeTo] + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [ColumnsSelectionDsl.cols] + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.all(): TransformableColumnSet = allColumnsInternal() as TransformableColumnSet + + /** + * ## All (Cols) + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all columns from [this], + * the opposite of [none][org.jetbrains.kotlinx.dataframe.api.NoneColumnsSelectionDsl.none]. + * + * This makes the function equivalent to [cols()][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] without filter. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `all` is named `allCols` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[move][org.jetbrains.kotlinx.dataframe.DataFrame.move]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() }.`[under][org.jetbrains.kotlinx.dataframe.api.MoveClause.under]`("info")` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroup.`[allCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[all][ColumnsSelectionDsl.all]`() }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @see [ColumnsSelectionDsl.rangeTo] + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [ColumnsSelectionDsl.cols] + */ + @Interpretable("All0") + public fun ColumnsSelectionDsl<*>.all(): TransformableColumnSet<*> = asSingleColumn().allColumnsInternal() + + /** + * ## All (Cols) + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all columns from [this], + * the opposite of [none][org.jetbrains.kotlinx.dataframe.api.NoneColumnsSelectionDsl.none]. + * + * This makes the function equivalent to [cols()][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] without filter. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `all` is named `allCols` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[move][org.jetbrains.kotlinx.dataframe.DataFrame.move]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() }.`[under][org.jetbrains.kotlinx.dataframe.api.MoveClause.under]`("info")` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroup.`[allCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myGroup.`[allCols][SingleColumn.allCols]`() }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @see [ColumnsSelectionDsl.rangeTo] + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [ColumnsSelectionDsl.cols] + */ + public fun SingleColumn>.allCols(): TransformableColumnSet<*> = + ensureIsColumnGroup().allColumnsInternal() + + /** + * ## All (Cols) + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all columns from [this], + * the opposite of [none][org.jetbrains.kotlinx.dataframe.api.NoneColumnsSelectionDsl.none]. + * + * This makes the function equivalent to [cols()][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] without filter. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `all` is named `allCols` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[move][org.jetbrains.kotlinx.dataframe.DataFrame.move]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() }.`[under][org.jetbrains.kotlinx.dataframe.api.MoveClause.under]`("info")` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroup.`[allCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myGroupCol".`[allCols][String.allCols]`() }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @see [ColumnsSelectionDsl.rangeTo] + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [ColumnsSelectionDsl.cols] + */ + public fun String.allCols(): TransformableColumnSet<*> = columnGroup(this).allCols() + + /** + * ## All (Cols) + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all columns from [this], + * the opposite of [none][org.jetbrains.kotlinx.dataframe.api.NoneColumnsSelectionDsl.none]. + * + * This makes the function equivalent to [cols()][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] without filter. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `all` is named `allCols` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[move][org.jetbrains.kotlinx.dataframe.DataFrame.move]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() }.`[under][org.jetbrains.kotlinx.dataframe.api.MoveClause.under]`("info")` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroup.`[allCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { DataSchemaType::columnGroup.`[allCols][KProperty.allCols]`() }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @see [ColumnsSelectionDsl.rangeTo] + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [ColumnsSelectionDsl.cols] + */ + public fun KProperty<*>.allCols(): TransformableColumnSet<*> = columnGroup(this).allCols() + + /** + * ## All (Cols) + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all columns from [this], + * the opposite of [none][org.jetbrains.kotlinx.dataframe.api.NoneColumnsSelectionDsl.none]. + * + * This makes the function equivalent to [cols()][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] without filter. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `all` is named `allCols` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[move][org.jetbrains.kotlinx.dataframe.DataFrame.move]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() }.`[under][org.jetbrains.kotlinx.dataframe.api.MoveClause.under]`("info")` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroup.`[allCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myGroup"].`[allCols][ColumnPath.allCols]`() }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @see [ColumnsSelectionDsl.rangeTo] + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [ColumnsSelectionDsl.cols] + */ + public fun ColumnPath.allCols(): TransformableColumnSet<*> = columnGroup(this).allCols() + + // endregion + + // region allAfter + + /** + * ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver] and absolutely. + */ + private interface AllAfterDocs + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allAfter][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allAfter]` { myColumn `[in][String.contains]` it.`[name][ColumnWithPath.name]` } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.allAfter(column: ColumnFilter): ColumnSet = + allAfterInternal(column as ColumnFilter<*>) as ColumnSet + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allAfter][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allAfter]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.allAfter(column: ColumnPath): ColumnSet = + allAfterInternal { it.path == column } as ColumnSet + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allAfter][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allAfter]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allAfter(column: String): ColumnSet = allAfter(pathOf(column)) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allAfter][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allAfter]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allAfter(column: AnyColumnReference): ColumnSet = allAfter(column.path()) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allAfter][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allAfter]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allAfter(column: KProperty<*>): ColumnSet = + allAfter(column.toColumnAccessor().path()) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl.allAfter(column: ColumnSelector): ColumnSet<*> = + asSingleColumn().allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allAfter(column: ColumnPath): ColumnSet<*> = asSingleColumn().allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allAfter(column: String): ColumnSet<*> = allAfter(pathOf(column)) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allAfter(column: AnyColumnReference): ColumnSet<*> = allAfter(column.path()) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allAfter(column: KProperty<*>): ColumnSet<*> = + allAfter(column.toColumnAccessor().path()) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsAfter][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsAfter]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsAfter(column: ColumnSelector): ColumnSet<*> { + var resolvedCol: DataColumn<*>? = null + return this + .ensureIsColumnGroup() + .onResolve { resolvedCol = it!!.asColumnGroup().getColumn(column) } + .allAfterInternal { it.data == resolvedCol!! } + } + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsAfter][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsAfter]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsAfter(column: ColumnPath): ColumnSet<*> { + var path: ColumnPath? = null + return this + .ensureIsColumnGroup() + .onResolve { path = it!!.path } + .allAfterInternal { + // accept both relative and full column path + it.path == path!! + column || it.path == column + } + } + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsAfter][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsAfter]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsAfter(column: String): ColumnSet<*> = allColsAfter(pathOf(column)) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsAfter][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsAfter]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsAfter(column: AnyColumnReference): ColumnSet<*> = + allColsAfter(column.path()) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsAfter][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsAfter]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsAfter(column: KProperty<*>): ColumnSet<*> = + allColsAfter(column.toColumnAccessor().path()) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsAfter][kotlin.String.allColsAfter]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsAfter(column: ColumnSelector<*, *>): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsAfter][kotlin.String.allColsAfter]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsAfter(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsAfter][kotlin.String.allColsAfter]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsAfter(column: String): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsAfter][kotlin.String.allColsAfter]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsAfter(column: AnyColumnReference): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsAfter][kotlin.String.allColsAfter]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsAfter(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + /** + * ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColGroup.`[allColsAfter][kotlin.reflect.KProperty.allColsAfter]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty.allColsAfter(column: ColumnSelector): ColumnSet<*> = + columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColGroup.`[allColsAfter][kotlin.reflect.KProperty.allColsAfter]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsAfter(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColGroup.`[allColsAfter][kotlin.reflect.KProperty.allColsAfter]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsAfter(column: String): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColGroup.`[allColsAfter][kotlin.reflect.KProperty.allColsAfter]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsAfter(column: AnyColumnReference): ColumnSet<*> = + columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColGroup.`[allColsAfter][kotlin.reflect.KProperty.allColsAfter]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsAfter(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsAfter][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsAfter]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsAfter(column: ColumnSelector<*, *>): ColumnSet<*> = + columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsAfter][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsAfter]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsAfter(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsAfter][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsAfter]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsAfter(column: String): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsAfter][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsAfter]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsAfter(column: AnyColumnReference): ColumnSet<*> = + columnGroup(this).allColsAfter(column) + + /** ## All (Cols) After + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns after [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allAfter][ColumnsSelectionDsl.allAfter]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsAfter][SingleColumn.allColsAfter]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allAfter][ColumnSet.allAfter]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsAfter][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsAfter]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns after [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column after which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsAfter(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsAfter(column) + + // endregion + + // region allFrom + + /** + * ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver] and absolutely. + */ + private interface AllFromDocs + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allFrom][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allFrom]` { myColumn `[in][String.contains]` it.`[name][ColumnWithPath.name]` } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.allFrom(column: ColumnFilter): ColumnSet = + allFromInternal(column as ColumnFilter<*>) as ColumnSet + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allFrom][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allFrom]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.allFrom(column: ColumnPath): ColumnSet = + allFromInternal { it.path == column } as ColumnSet + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allFrom][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allFrom]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allFrom(column: String): ColumnSet = allFrom(pathOf(column)) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allFrom][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allFrom]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allFrom(column: AnyColumnReference): ColumnSet = allFrom(column.path()) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allFrom][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allFrom]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allFrom(column: KProperty<*>): ColumnSet = allFrom(column.toColumnAccessor().path()) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allFrom]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl.allFrom(column: ColumnSelector): ColumnSet<*> = + asSingleColumn().allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allFrom]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allFrom(column: ColumnPath): ColumnSet<*> = asSingleColumn().allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allFrom]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allFrom(column: String): ColumnSet<*> = asSingleColumn().allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allFrom]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allFrom(column: AnyColumnReference): ColumnSet<*> = + asSingleColumn().allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allFrom]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allFrom(column: KProperty<*>): ColumnSet<*> = asSingleColumn().allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsFrom][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsFrom]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsFrom(column: ColumnSelector): ColumnSet<*> { + var resolvedCol: DataColumn<*>? = null + return this + .ensureIsColumnGroup() + .onResolve { resolvedCol = it!!.asColumnGroup().getColumn(column) } + .allFromInternal { it.data == resolvedCol!! } + } + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsFrom][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsFrom]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsFrom(column: ColumnPath): ColumnSet<*> { + var path: ColumnPath? = null + return this + .ensureIsColumnGroup() + .onResolve { path = it!!.path } + .allFromInternal { + // accept both relative and full column path + it.path == path!! + column || it.path == column + } + } + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsFrom][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsFrom]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsFrom(column: String): ColumnSet<*> = allColsFrom(pathOf(column)) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsFrom][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsFrom]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsFrom(column: AnyColumnReference): ColumnSet<*> = + allColsFrom(column.path()) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsFrom][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsFrom]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsFrom(column: KProperty<*>): ColumnSet<*> = + allColsFrom(column.toColumnAccessor().path()) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsFrom][kotlin.String.allColsFrom]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsFrom(column: ColumnSelector<*, *>): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsFrom][kotlin.String.allColsFrom]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsFrom(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsFrom][kotlin.String.allColsFrom]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsFrom(column: String): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsFrom][kotlin.String.allColsFrom]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsFrom(column: AnyColumnReference): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsFrom][kotlin.String.allColsFrom]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsFrom(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** + * ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsFrom][kotlin.reflect.KProperty.allColsFrom]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty.allColsFrom(column: ColumnSelector): ColumnSet<*> = + columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsFrom][kotlin.reflect.KProperty.allColsFrom]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsFrom(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsFrom][kotlin.reflect.KProperty.allColsFrom]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsFrom(column: String): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsFrom][kotlin.reflect.KProperty.allColsFrom]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsFrom(column: AnyColumnReference): ColumnSet<*> = + columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsFrom][kotlin.reflect.KProperty.allColsFrom]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsFrom(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allFrom][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsFrom]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsFrom(column: ColumnSelector<*, *>): ColumnSet<*> = + columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allFrom][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsFrom]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsFrom(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allFrom][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsFrom]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsFrom(column: String): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allFrom][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsFrom]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsFrom(column: AnyColumnReference): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + /** ## All (Cols) From + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns from [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return an empty [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allFrom][ColumnsSelectionDsl.allFrom]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsFrom][SingleColumn.allColsFrom]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allFrom][ColumnSet.allFrom]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allFrom][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsFrom]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column from which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsFrom(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsFrom(column) + + // endregion + + // region allBefore + + /** + * ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver] and absolutely. + */ + private interface AllBeforeDocs + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allBefore][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allBefore]` { myColumn `[in][String.contains]` it.`[name][ColumnWithPath.name]` } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.allBefore(column: ColumnFilter): ColumnSet = + allBeforeInternal(column as ColumnFilter<*>) as ColumnSet + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allBefore][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allBefore]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.allBefore(column: ColumnPath): ColumnSet = + allBeforeInternal { it.path == column } as ColumnSet + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allBefore][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allBefore]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allBefore(column: String): ColumnSet = allBefore(pathOf(column)) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allBefore][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allBefore]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allBefore(column: AnyColumnReference): ColumnSet = allBefore(column.path()) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allBefore][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allBefore]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allBefore(column: KProperty<*>): ColumnSet = + allBefore(column.toColumnAccessor().path()) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allBefore]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl.allBefore(column: ColumnSelector): ColumnSet<*> = + asSingleColumn().allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allBefore]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allBefore(column: ColumnPath): ColumnSet<*> = + asSingleColumn().allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allBefore]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allBefore(column: String): ColumnSet<*> = allBefore(pathOf(column)) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allBefore]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allBefore(column: AnyColumnReference): ColumnSet<*> = allBefore(column.path()) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allBefore]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allBefore(column: KProperty<*>): ColumnSet<*> = + allBefore(column.toColumnAccessor().path()) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsBefore][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsBefore]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsBefore(column: ColumnSelector): ColumnSet<*> { + var resolvedCol: DataColumn<*>? = null + return this + .ensureIsColumnGroup() + .onResolve { resolvedCol = it!!.asColumnGroup().getColumn(column) } + .allBeforeInternal { it.data == resolvedCol } + } + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsBefore][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsBefore]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsBefore(column: ColumnPath): ColumnSet<*> { + var path: ColumnPath? = null + return this + .ensureIsColumnGroup() + .onResolve { path = it!!.path } + .allBeforeInternal { it.path == path!! + column || it.path == column } + } + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsBefore][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsBefore]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsBefore(column: String): ColumnSet<*> = allColsBefore(pathOf(column)) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsBefore][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsBefore]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsBefore(column: AnyColumnReference): ColumnSet<*> = + allColsBefore(column.path()) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsBefore][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsBefore]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsBefore(column: KProperty<*>): ColumnSet<*> = + allColsBefore(column.toColumnAccessor().path()) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsBefore][kotlin.String.allColsBefore]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsBefore(column: ColumnSelector<*, *>): ColumnSet<*> = + columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsBefore][kotlin.String.allColsBefore]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsBefore(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsBefore][kotlin.String.allColsBefore]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsBefore(column: String): ColumnSet<*> = columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsBefore][kotlin.String.allColsBefore]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsBefore(column: AnyColumnReference): ColumnSet<*> = columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsBefore][kotlin.String.allColsBefore]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsBefore(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsBefore(column) + + /** + * ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsBefore][kotlin.reflect.KProperty.allColsBefore]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty.allColsBefore(column: ColumnSelector): ColumnSet<*> = + columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsBefore][kotlin.reflect.KProperty.allColsBefore]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsBefore(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsBefore][kotlin.reflect.KProperty.allColsBefore]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsBefore(column: String): ColumnSet<*> = columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsBefore][kotlin.reflect.KProperty.allColsBefore]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsBefore(column: AnyColumnReference): ColumnSet<*> = + columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsBefore][kotlin.reflect.KProperty.allColsBefore]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsBefore(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsBefore][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsBefore]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsBefore(column: ColumnSelector<*, *>): ColumnSet<*> = + columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsBefore][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsBefore]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsBefore(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsBefore][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsBefore]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsBefore(column: String): ColumnSet<*> = columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsBefore][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsBefore]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsBefore(column: AnyColumnReference): ColumnSet<*> = + columnGroup(this).allColsBefore(column) + + /** ## All (Cols) Before + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns before [column], excluding [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allBefore][ColumnsSelectionDsl.allBefore]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsBefore][SingleColumn.allColsBefore]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allBefore][ColumnSet.allBefore]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsBefore][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsBefore]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns before [column], excluding [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column before which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsBefore(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsBefore(column) + + // endregion + + // region allUpTo + + /** + * ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver] and absolutely. + */ + private interface AllUpToDocs + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allUpTo][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allUpTo]` { myColumn `[in][String.contains]` it.`[name][ColumnWithPath.name]` } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.allUpTo(column: ColumnFilter): ColumnSet = + allUpToInternal(column as ColumnFilter<*>) as ColumnSet + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allUpTo][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allUpTo]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.allUpTo(column: ColumnPath): ColumnSet = + allUpToInternal { it.path == column } as ColumnSet + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allUpTo][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allUpTo]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allUpTo(column: String): ColumnSet = allUpTo(pathOf(column)) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allUpTo][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allUpTo]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allUpTo(column: AnyColumnReference): ColumnSet = allUpTo(column.path()) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { .. }.`[allUpTo][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.allUpTo]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnSet.allUpTo(column: KProperty<*>): ColumnSet = allUpTo(column.toColumnAccessor().path()) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl.allUpTo(column: ColumnSelector): ColumnSet<*> = + asSingleColumn().allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allUpTo(column: ColumnPath): ColumnSet<*> = asSingleColumn().allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allUpTo(column: String): ColumnSet<*> = asSingleColumn().allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allUpTo(column: AnyColumnReference): ColumnSet<*> = + asSingleColumn().allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnsSelectionDsl<*>.allUpTo(column: KProperty<*>): ColumnSet<*> = asSingleColumn().allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsUpTo][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsUpTo]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsUpTo(column: ColumnSelector): ColumnSet<*> { + var resolvedCol: DataColumn<*>? = null + return this + .ensureIsColumnGroup() + .onResolve { resolvedCol = it!!.asColumnGroup().getColumn(column) } + .allUpToInternal { it.data == resolvedCol!! } + } + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsUpTo][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsUpTo]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsUpTo(column: ColumnPath): ColumnSet<*> { + var path: ColumnPath? = null + return this + .ensureIsColumnGroup() + .onResolve { path = it!!.path } + .allUpToInternal { + // accept both relative and full column path + it.path == path!! + column || it.path == column + } + } + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsUpTo][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsUpTo]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsUpTo(column: String): ColumnSet<*> = allColsUpTo(pathOf(column)) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsUpTo][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsUpTo]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsUpTo(column: AnyColumnReference): ColumnSet<*> = + allColsUpTo(column.path()) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { someColumnGroup.`[allColsUpTo][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsUpTo]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun SingleColumn>.allColsUpTo(column: KProperty<*>): ColumnSet<*> = + allColsUpTo(column.toColumnAccessor().path()) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsUpTo][kotlin.String.allColsUpTo]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsUpTo(column: ColumnSelector<*, *>): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsUpTo][kotlin.String.allColsUpTo]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsUpTo(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsUpTo][kotlin.String.allColsUpTo]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsUpTo(column: String): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsUpTo][kotlin.String.allColsUpTo]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsUpTo(column: AnyColumnReference): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someColGroup".`[allColsUpTo][kotlin.String.allColsUpTo]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun String.allColsUpTo(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** + * ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsUpTo][kotlin.reflect.KProperty.allColsUpTo]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty.allColsUpTo(column: ColumnSelector): ColumnSet<*> = + columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsUpTo][kotlin.reflect.KProperty.allColsUpTo]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsUpTo(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsUpTo][kotlin.reflect.KProperty.allColsUpTo]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsUpTo(column: String): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsUpTo][kotlin.reflect.KProperty.allColsUpTo]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsUpTo(column: AnyColumnReference): ColumnSet<*> = + columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::someColGroup.`[allColsUpTo][kotlin.reflect.KProperty.allColsUpTo]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun KProperty<*>.allColsUpTo(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsUpTo][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsUpTo]` { myColumn } }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsUpTo(column: ColumnSelector<*, *>): ColumnSet<*> = + columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsUpTo][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsUpTo]`("pathTo"["myColumn"]) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsUpTo(column: ColumnPath): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsUpTo][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsUpTo]`("myColumn") }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsUpTo(column: String): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsUpTo][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsUpTo]`(myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsUpTo(column: AnyColumnReference): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + /** ## All (Cols) Up To + * + * Creates a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains a subset of columns from [this], + * containing all columns up to [column], including [column] itself. + * + * [column] can be specified both relative to the current [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] or the outer scope and + * can be referenced using any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * If [column] does not exist, the function will return a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns. + * + *      + * + * NOTE: Using the `{}` overloads of these functions requires a [ColumnSelector][org.jetbrains.kotlinx.dataframe.ColumnSelector] + * in the Plain DSL and on [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] it requires a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allUpTo][ColumnsSelectionDsl.allUpTo]`("someColumn") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[allColsUpTo][SingleColumn.allColsUpTo]`(someColumn) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[allUpTo][ColumnSet.allUpTo]`(Type::someColumn) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["someColGroup"].`[allColsUpTo][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.allColsUpTo]`(Type::myColumn) }` + * + * #### Flavors of All (Cols): + * + * - [`all(Cols)`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()`: + * All columns + * + * - [`all(Cols)Before`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsBefore]`(column)`: + * All columns before the specified column, excluding that column + * + * - [`all(Cols)After`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsAfter]`(column)`: + * All columns after the specified column, excluding that column + * + * - [`all(Cols)From`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsFrom]`(column)`: + * All columns from the specified column, including that column + * + * - [`all(Cols)UpTo`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allColsUpTo]`(column)`: + * All columns up to the specified column, including that column + * + * @return A new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns up to [column], including [column] itself. + * @see [allBefore] + * @see [allAfter] + * @see [allFrom] + * @see [allUpTo] + * @see [ColumnsSelectionDsl.allExcept] + * @see [all] + * @see [cols] + * @param [column] The specified column up to which all columns should be taken. This column can be referenced + * to both relatively to the current [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] and absolutely. + */ + public fun ColumnPath.allColsUpTo(column: KProperty<*>): ColumnSet<*> = columnGroup(this).allColsUpTo(column) + + // endregion +} + +/** + * If [this] is a [SingleColumn] containing a single [ColumnGroup], it + * returns a [(transformable) ColumnSet][TransformableColumnSet] containing the children of this [ColumnGroup], + * else it simply returns a [(transformable) ColumnSet][TransformableColumnSet] from [this]. + */ +internal fun ColumnsResolver<*>.allColumnsInternal(removePaths: Boolean = false): TransformableColumnSet<*> = + transform { + if (isSingleColumnWithGroup(it)) { + it.single().let { + if (removePaths) { + it.asColumnGroup().columns().map(AnyCol::addPath) + } else { + it.cols() + } + } + } else { + it + } + } + +/** + * Returns a new ColumnSet containing all columns after the first column that matches the given predicate. + * + * @param colByPredicate a function that takes a ColumnWithPath and returns true if the column matches the predicate, false otherwise + * @return a new ColumnSet containing all columns after the first column that matches the given predicate + */ +internal fun ColumnsResolver<*>.allAfterInternal(colByPredicate: ColumnFilter<*>): ColumnSet<*> { + var take = false + return colsInternal { + if (take) { + true + } else { + take = colByPredicate(it) + false + } + } +} + +/** + * Returns a column set containing all columns from the internal column set that satisfy the given predicate. + * + * @param colByPredicate the predicate used to determine if a column should be included in the resulting set + * @return a column set containing all columns that satisfy the predicate + */ +internal fun ColumnsResolver<*>.allFromInternal(colByPredicate: ColumnFilter<*>): ColumnSet<*> { + var take = false + return colsInternal { + if (take) { + true + } else { + take = colByPredicate(it) + take + } + } +} + +/** + * Returns a new ColumnSet containing all columns before the first column that satisfies the given predicate. + * + * @param colByPredicate the predicate function used to determine if a column should be included in the returned ColumnSet + * @return a new ColumnSet containing all columns that come before the first column that satisfies the given predicate + */ +internal fun ColumnsResolver<*>.allBeforeInternal(colByPredicate: ColumnFilter<*>): ColumnSet<*> { + var take = true + return colsInternal { + if (!take) { + false + } else { + take = !colByPredicate(it) + take + } + } +} + +/** + * Returns a ColumnSet containing all columns up to (and including) the first column that satisfies the given predicate. + * + * @param colByPredicate a predicate function that takes a ColumnWithPath and returns true if the column satisfies the desired condition. + * @return a ColumnSet containing all columns up to the first column that satisfies the given predicate. + */ +internal fun ColumnsResolver<*>.allUpToInternal(colByPredicate: ColumnFilter<*>): ColumnSet<*> { + var take = true + return colsInternal { + if (!take) { + false + } else { + take = !colByPredicate(it) + true + } + } +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/allExcept.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/allExcept.kt new file mode 100644 index 000000000..493295e20 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/allExcept.kt @@ -0,0 +1,4571 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.aggregation.toColumns +import org.jetbrains.kotlinx.dataframe.impl.columns.allColumnsExceptKeepingStructure +import org.jetbrains.kotlinx.dataframe.impl.columns.changePath +import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle +import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_EXCEPT +import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_REPLACE +import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_REPLACE_VARARG +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## (All) (Cols) Except [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface AllExceptColumnsSelectionDsl { + + /** + * ## (All) (Cols) Except Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `colsSelector: `[`ColumnsSelector`][org.jetbrains.kotlinx.dataframe.ColumnsSelector] + * + *      + * + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `columnNoAccessor: `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `columnsResolver: `[`ColumnsResolver`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`allExcept`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]**` { `**[`colsSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsSelectorDef]**` }`** + * + * `| `[**`allExcept`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` ..`**`)`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     [**`except`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` [`**` { `**`] `[`columnsResolver`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsResolverDef]` [`**` } `**`]` + * + *     `| `[**`except`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef] + * + *     `| `**`.`**[**`except`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` ..`**`)`** + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`allColsExcept`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept]**` { `**[`colsSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsSelectorDef]**` } `** + * + *     `| `__`.`__[**`allColsExcept`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept]**`(`**[`columnNoAccessor`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnNoAccessorDef]**`,`**` ..`**`)`** + * + *     `| `[**`exceptNew`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.exceptNew]**` { `**[`colsSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsSelectorDef]**` } EXPERIMENTAL!`** + * + *     `| `[**`exceptNew`**][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.exceptNew]**`(`**[`columnNoAccessor`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnNoAccessorDef]**`,`**` ..`**`) EXPERIMENTAL!`** + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`allExcept`**][ColumnsSelectionDsl.allExcept] */ + public interface PlainDslName + + /** [**`except`**][ColumnsSelectionDsl.except] */ + public interface ColumnSetName + + /** __`.`__[**`allColsExcept`**][ColumnsSelectionDsl.allColsExcept] */ + public interface ColumnGroupName + + /** [**`exceptNew`**][ColumnsSelectionDsl.exceptNew] */ + public interface ColumnGroupExperimentalName + } + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar] + * + * ### On [ColumnSets][ColumnSet] + * This function can be explained the easiest with [ColumnSets][ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][DataFrame.select]` { `[colsOf][colsOf]`<`[Int][Int]`>() `[except][ColumnSet.except]` (age `[and][ColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet] created by `age `[and][ColumnsSelectionDsl.and]` height` from the [ColumnSet] created by [colsOf][colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][ColumnGroup]. + * + * For instance: + * + * `df.`[select][DataFrame.select]` { `[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][DataColumn.name]`() } `[except][ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][ColumnGroup]). You could say the receiver [ColumnSet] + * is [simplified][ColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][ColumnSet.except]`(a.b)` + * + * `== `[cols][ColumnsSelectionDsl.cols]`(a).`[except][ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][ColumnsSelectionDsl] + * Instead of having to write [all][ColumnsSelectionDsl.all]`() `[except][ColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][DataFrame.select]` { `[allExcept][ColumnsSelectionDsl.allExcept]` { userData.age `[and][ColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][ColumnGroup] + * The variant of this function on [ColumnGroups][ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][DataFrame.select]` { myColGroup.`[allColsExcept][SingleColumn.allColsExcept]` { colA `[and][ColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][DataFrame.select]` { myColGroup.`[select][ColumnsSelectionDsl.select]` { `[all][ColumnsSelectionDsl.all]`() `[except][ColumnSet.except]` { colA `[and][ColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][DataFrame.select]` { myColGroup.`[allCols][ColumnsSelectionDsl.allCols]`() `[except][ColumnSet.except]` { myColGroup.colA `[and][ColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][ColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * + * + * @return A [ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + private interface CommonExceptDocs { + + // Example argument + interface ExampleArg + + // Parameter argument + interface ParamArg + } + + // region ColumnSet + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][ColumnsSelectionDsl.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>() `[except][ColumnSet.except]` `` }` + * + * `df.`[select][ColumnsSelectionDsl.select]` { `[cols][ColumnsSelectionDsl.cols]`(name, age) `[except][ColumnSet.except]` `` }` + * + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + private interface ColumnSetInfixDocs { + + // argument + interface ArgumentArg1 + + // argument + interface ArgumentArg2 + } + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][ColumnsSelectionDsl.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>().`[except][ColumnSet.except]` }` + * + * `df.`[select][ColumnsSelectionDsl.select]` { `[cols][ColumnsSelectionDsl.cols]`(name, age).`[except][ColumnSet.except]` }` + * + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + private interface ColumnSetVarargDocs { + + // argument + interface ArgumentArg1 + + // argument + interface ArgumentArg2 + } + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` ``{ "age" `[and][ColumnsSelectionDsl.and]` height }`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(name, age) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` ``{ name.firstName }`` }` + * + * @param [selector] A lambda in which you specify the columns that need to be + * excluded from the [ColumnSet]. The scope of the selector is the same as the outer scope. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + public infix fun ColumnSet.except(selector: () -> ColumnsResolver<*>): ColumnSet = except(selector()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` ``"age" `[and][ColumnsSelectionDsl.and]` height`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(name, age) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` ``name.firstName`` }` + * + * @param [other] A [ColumnsResolver] containing the columns that need to be + * excluded from the [ColumnSet]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + public infix fun ColumnSet.except(other: ColumnsResolver<*>): ColumnSet = exceptInternal(other) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>().`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(age, userData.height)`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(name, age).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(name.firstName, name.middleName)`` }` + * + * @param [others] Any number of [ColumnsResolvers][ColumnsResolver] containing + * the columns that need to be excluded from the [ColumnSet]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + public fun ColumnSet.except(vararg others: ColumnsResolver<*>): ColumnSet = except(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` ``"age"`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(name, age) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` ``"name"`` }` + * + * @param [other] A [String] referring to + * the column (relative to the current scope) that needs to be excluded from the [ColumnSet]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + public infix fun ColumnSet.except(other: String): ColumnSet = except(column(other)) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>().`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`("age", "height")`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(name, age).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`("name")`` }` + * + * @param [others] Any number of [Strings][String] referring to + * the columns (relative to the current scope) that need to be excluded from the [ColumnSet]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + public fun ColumnSet.except(vararg others: String): ColumnSet = except(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` ``Person::age`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(name, age) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` ``Person::name`` }` + * + * @param [other] A [KProperty] referring to + * the column (relative to the current scope) that needs to be excluded from the [ColumnSet]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + public infix fun ColumnSet.except(other: KProperty): ColumnSet = except(column(other)) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>().`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(Person::age, Person::height)`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(name, age).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(Person::name)`` }` + * + * @param [others] Any number of [KProperties][KProperty] referring to + * the columns (relative to the current scope) that need to be excluded from the [ColumnSet]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + public fun ColumnSet.except(vararg others: KProperty): ColumnSet = except(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` ``"userdata"["age"]`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(name, age) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` ``pathOf("name", "firstName")`` }` + * + * @param [other] A [ColumnPath] referring to + * the column (relative to the current scope) that needs to be excluded from the [ColumnSet]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + public infix fun ColumnSet.except(other: ColumnPath): ColumnSet = except(column(other)) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Number][Number]`>().`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(pathOf("age"), "userdata"["height"])`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(name, age).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`("name"["firstName"], "name"["middleName"])`` }` + * + * @param [others] Any number of [ColumnPaths][ColumnPath] referring to + * the columns (relative to the current scope) that need to be excluded from the [ColumnSet]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + * + */ + public fun ColumnSet.except(vararg others: ColumnPath): ColumnSet = except(others.toColumnSet()) + + // endregion + + // region ColumnsSelectionDsl + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][ColumnsSelectionDsl.select]` { `[allExcept][ColumnsSelectionDsl.allExcept]` }` + * + * `df.`[select][ColumnsSelectionDsl.select]` { `[allExcept][ColumnsSelectionDsl.allExcept]` }` + * + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + private interface ColumnsSelectionDslDocs { + + // argument + interface ArgumentArg1 + + // argument + interface ArgumentArg2 + } + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { "age" `[and][ColumnsSelectionDsl.and]` height }`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { name.firstName }`` }` + * + * @param [selector] A lambda in which you specify the columns that need to be + * excluded from the current selection. The scope of the selector is the same as the outer scope. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun ColumnsSelectionDsl.allExcept(selector: ColumnsSelector): ColumnSet<*> = + this.asSingleColumn().allColsExcept(selector) + + /** + * + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]`(age, height)`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]`(name.firstName, name.middleName)`` }` + * + * @param [others] A [ColumnsResolver] containing the columns that need to be + * excluded from the current selection. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun ColumnsSelectionDsl<*>.allExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> = + asSingleColumn().allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]`("age", "height")`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]`("name")`` }` + * + * @param [others] Any number of [Strings][String] referring to + * the columns (relative to the current scope) that need to be excluded from the current selection. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun ColumnsSelectionDsl<*>.allExcept(vararg others: String): ColumnSet<*> = + asSingleColumn().allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]`(Person::age, Person::height)`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]`(Person::name)`` }` + * + * @param [others] Any number of [KProperties][KProperty] referring to + * the columns (relative to the current scope) that need to be excluded from the current selection. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun ColumnsSelectionDsl<*>.allExcept(vararg others: KProperty<*>): ColumnSet<*> = + asSingleColumn().allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]`(pathOf("age"), "userdata"["height"])`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]`("name"["firstName"], "name"["middleName"])`` }` + * + * @param [others] Any number of [ColumnPaths][ColumnPath] referring to + * the columns (relative to the current scope) that need to be excluded from the current selection. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun ColumnsSelectionDsl<*>.allExcept(vararg others: ColumnPath): ColumnSet<*> = + asSingleColumn().allColsExceptInternal(others.toColumnSet()) + + // endregion + + // region SingleColumn + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][ColumnsSelectionDsl.select]` { `[allColsExcept][.allColsExcept]` }` + * + * `df.`[select][ColumnsSelectionDsl.select]` { city `[and][ColumnsSelectionDsl.and]` `[allColsExcept][.allColsExcept]` }` + * + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + private interface ColumnGroupDocs { + + // receiver + interface ReceiverArg1 + + // receiver + interface ReceiverArg2 + + // type + interface ReceiverType + + // argument + interface ArgumentArg1 + + // argument + interface ArgumentArg2 + + /** + */ + interface SingleColumnReceiverArgs + + /** + */ + interface StringReceiverArgs + + /** + */ + interface KPropertyReceiverArgs + + /** + */ + interface ColumnPathReceiverArgs + + /** + */ + interface SelectorArgs + + /** + */ + interface StringArgs + + /** + */ + interface KPropertyArgs + + /** + */ + interface ColumnPathArgs + } + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``userData.`[allColsExcept][SingleColumn.allColsExcept]` { "age" `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height }`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``name.`[allColsExcept][SingleColumn.allColsExcept]` { firstName }`` }` + * + * @param [selector] A lambda in which you specify the columns that need to be + * excluded from the current selection in [this] column group. The other columns will be included in the selection + * by default. The scope of the selector is relative to the column group. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun SingleColumn>.allColsExcept(selector: ColumnsSelector): ColumnSet<*> = + allColsExceptInternal(selector.toColumns()) + + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith(ALL_COLS_REPLACE), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun SingleColumn>.allColsExcept(other: ColumnsResolver<*>): ColumnSet<*> = + allColsExcept { other } + + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun SingleColumn>.allColsExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> = + allColsExcept { others.toColumnSet() } + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``userData.`[allColsExcept][SingleColumn.allColsExcept]`("age", "height")`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``name.`[allColsExcept][SingleColumn.allColsExcept]`("firstName", "middleName")`` }` + * + * @param [others] Any number of [Strings][String] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun SingleColumn>.allColsExcept(vararg others: String): ColumnSet<*> = + allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``userData.`[allColsExcept][SingleColumn.allColsExcept]`(Person::age, Person::height)`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``name.`[allColsExcept][SingleColumn.allColsExcept]`(Person::firstName, Person::middleName)`` }` + * + * @param [others] Any number of [KProperties][KProperty] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun SingleColumn>.allColsExcept(vararg others: KProperty<*>): ColumnSet<*> = + allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``userData.`[allColsExcept][SingleColumn.allColsExcept]`(pathOf("age"), "extraData"["item1"])`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``name.`[allColsExcept][SingleColumn.allColsExcept]`(pathOf("firstName"), "middleNames"["first"])`` }` + * + * @param [others] Any number of [ColumnPaths][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun SingleColumn>.allColsExcept(vararg other: ColumnPath): ColumnSet<*> = + allColsExceptInternal(other.toColumnSet()) + + // endregion + + // region String + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``"userData".`[allColsExcept][String.allColsExcept]` { "age" `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height }`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``"name".`[allColsExcept][String.allColsExcept]` { firstName }`` }` + * + * @param [selector] A lambda in which you specify the columns that need to be + * excluded from the current selection in [this] column group. The other columns will be included in the selection + * by default. The scope of the selector is relative to the column group. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun String.allColsExcept(selector: ColumnsSelector<*, *>): ColumnSet<*> = + columnGroup(this).allColsExcept(selector) + + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith(ALL_COLS_REPLACE), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun String.allColsExcept(other: ColumnsResolver<*>): ColumnSet<*> = + allColsExcept { other } + + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun String.allColsExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> = + allColsExcept { others.toColumnSet() } + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``"userData".`[allColsExcept][String.allColsExcept]`("age", "height")`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``"name".`[allColsExcept][String.allColsExcept]`("firstName", "middleName")`` }` + * + * @param [others] Any number of [Strings][String] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun String.allColsExcept(vararg others: String): ColumnSet<*> = + columnGroup(this).allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``"userData".`[allColsExcept][String.allColsExcept]`(Person::age, Person::height)`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``"name".`[allColsExcept][String.allColsExcept]`(Person::firstName, Person::middleName)`` }` + * + * @param [others] Any number of [KProperties][KProperty] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun String.allColsExcept(vararg others: KProperty<*>): ColumnSet<*> = + columnGroup(this).allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``"userData".`[allColsExcept][String.allColsExcept]`(pathOf("age"), "extraData"["item1"])`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``"name".`[allColsExcept][String.allColsExcept]`(pathOf("firstName"), "middleNames"["first"])`` }` + * + * @param [others] Any number of [ColumnPaths][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun String.allColsExcept(vararg others: ColumnPath): ColumnSet<*> = + columnGroup(this).allColsExceptInternal(others.toColumnSet()) + + // endregion + + // region KProperty + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``DataSchemaPerson::userData.`[allColsExcept][KProperty.allColsExcept]` { "age" `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height }`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``Person::name.`[allColsExcept][KProperty.allColsExcept]` { firstName }`` }` + * + * @param [selector] A lambda in which you specify the columns that need to be + * excluded from the current selection in [this] column group. The other columns will be included in the selection + * by default. The scope of the selector is relative to the column group. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun KProperty.allColsExcept(selector: ColumnsSelector): ColumnSet<*> = + columnGroup(this).allColsExcept(selector) + + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith(ALL_COLS_REPLACE), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun KProperty<*>.allColsExcept(other: ColumnsResolver<*>): ColumnSet<*> = + allColsExcept { other } + + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun KProperty<*>.allColsExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> = + allColsExcept { others.toColumnSet() } + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``DataSchemaPerson::userData.`[allColsExcept][KProperty.allColsExcept]`("age", "height")`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``Person::name.`[allColsExcept][KProperty.allColsExcept]`("firstName", "middleName")`` }` + * + * @param [others] Any number of [Strings][String] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun KProperty<*>.allColsExcept(vararg others: String): ColumnSet<*> = + columnGroup(this).allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``DataSchemaPerson::userData.`[allColsExcept][KProperty.allColsExcept]`(Person::age, Person::height)`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``Person::name.`[allColsExcept][KProperty.allColsExcept]`(Person::firstName, Person::middleName)`` }` + * + * @param [others] Any number of [KProperties][KProperty] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun KProperty<*>.allColsExcept(vararg others: KProperty<*>): ColumnSet<*> = + columnGroup(this).allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``DataSchemaPerson::userData.`[allColsExcept][KProperty.allColsExcept]`(pathOf("age"), "extraData"["item1"])`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``Person::name.`[allColsExcept][KProperty.allColsExcept]`(pathOf("firstName"), "middleNames"["first"])`` }` + * + * @param [others] Any number of [ColumnPaths][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun KProperty<*>.allColsExcept(vararg others: ColumnPath): ColumnSet<*> = + columnGroup(this).allColsExceptInternal(others.toColumnSet()) + + // endregion + + // region ColumnPath + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``pathOf("userData").`[allColsExcept][ColumnPath.allColsExcept]` { "age" `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height }`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``"pathTo"["myColGroup"].`[allColsExcept][ColumnPath.allColsExcept]` { firstName }`` }` + * + * @param [selector] A lambda in which you specify the columns that need to be + * excluded from the current selection in [this] column group. The other columns will be included in the selection + * by default. The scope of the selector is relative to the column group. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun ColumnPath.allColsExcept(selector: ColumnsSelector<*, *>): ColumnSet<*> = + columnGroup(this).allColsExcept(selector) + + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith(ALL_COLS_REPLACE), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun ColumnPath.allColsExcept(other: ColumnsResolver<*>): ColumnSet<*> = + allColsExcept { other } + + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun ColumnPath.allColsExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> = + allColsExcept { others.toColumnSet() } + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``pathOf("userData").`[allColsExcept][ColumnPath.allColsExcept]`("age", "height")`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``"pathTo"["myColGroup"].`[allColsExcept][ColumnPath.allColsExcept]`("firstName", "middleName")`` }` + * + * @param [others] Any number of [Strings][String] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun ColumnPath.allColsExcept(vararg others: String): ColumnSet<*> = + columnGroup(this).allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``pathOf("userData").`[allColsExcept][ColumnPath.allColsExcept]`(Person::age, Person::height)`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``"pathTo"["myColGroup"].`[allColsExcept][ColumnPath.allColsExcept]`(Person::firstName, Person::middleName)`` }` + * + * @param [others] Any number of [KProperties][KProperty] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun ColumnPath.allColsExcept(vararg others: KProperty<*>): ColumnSet<*> = + columnGroup(this).allColsExceptInternal(others.toColumnSet()) + + /** + * ## (All) (Cols) Except + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] to + * exclude from the current selection. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.Grammar] + * + * ### On [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * This function can be explained the easiest with [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. Let's say we want all + * [Int] columns apart from `age` and `height`. + * + * We can do: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` (age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height) }` + * + * which will 'subtract' the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by `age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height` from the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] created by [colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Int][Int]`>()`. + * + * + *      + * + * This operation can also be used to exclude columns from [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * For instance: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "a" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`() } `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` userData.age }` + * + *      + * + * + * Note that the selection of columns to exclude from [column sets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] is always done relative to the outer + * scope. Use the [Extension Properties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ExtensionPropertiesApi] to prevent scoping issues if possible. + * + *      + * + * Special case: If a column that needs to be removed appears multiple times in the [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet], it is excepted + * each time it is encountered (including inside [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]). You could say the receiver [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] + * is [simplified][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify] before the operation is performed: + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a, a, a.b, a.b).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * `== `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(a).`[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]`(a.b)` + * + * ### In the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * Instead of having to write [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]` { ... }` in the DSL, + * you can use [allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { ... }` to achieve the same result. + * + * For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[allExcept][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allExcept]` { userData.age `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` height } }` + * + * ### On [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * The variant of this function on [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] is a bit different as it changes the scope relative to + * the column group. + * + *      + * + * In other words: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allColsExcept][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.allColsExcept]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } }` + * + * is shorthand for + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colB } } }` + * + * or + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`() `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` { myColGroup.colA `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` myColGroup.colB } }` + * + *      + * + * Also note the name change, similar to [allCols][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols], this makes it clearer that you're selecting + * columns inside the group, 'lifting' them out. + * + * ### Examples for this overload + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { ``pathOf("userData").`[allColsExcept][ColumnPath.allColsExcept]`(pathOf("age"), "extraData"["item1"])`` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]` { city `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` ``"pathTo"["myColGroup"].`[allColsExcept][ColumnPath.allColsExcept]`(pathOf("firstName"), "middleNames"["first"])`` }` + * + * @param [others] Any number of [ColumnPaths][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] referring to + * the columns (relative to the column group) that need to be excluded from the current selection in [this] + * column group. The other columns will be included in the selection by default. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns in [this] except the specified ones. + * @see ColumnsSelectionDsl.select + * @see ColumnsSelectionDsl.all + * @see ColumnsSelectionDsl.allBefore + * @see ColumnsSelectionDsl.allAfter + * @see ColumnsSelectionDsl.allUpTo + * @see ColumnsSelectionDsl.allFrom + */ + public fun ColumnPath.allColsExcept(vararg others: ColumnPath): ColumnSet<*> = + columnGroup(this).allColsExceptInternal(others.toColumnSet()) + + // endregion + + // region experiments + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]`(colGroup) `[except][ColumnSet.except]` colGroup.col }` + * + * `df.`[select][DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + private interface ExperimentalExceptDocs + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun SingleColumn>.exceptNew(selector: ColumnsSelector): SingleColumn> = + exceptExperimentalInternal(selector.toColumns()) + + @ExperimentalExceptCsDsl + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith("exceptNew { other }"), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public infix fun SingleColumn>.exceptNew(other: ColumnsResolver<*>): SingleColumn> = + exceptNew { other } + + @ExperimentalExceptCsDsl + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith("exceptNew { others.toColumnSet() }"), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun SingleColumn>.exceptNew(vararg others: ColumnsResolver<*>): SingleColumn> = + exceptNew { others.toColumnSet() } + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun SingleColumn>.exceptNew(other: String): SingleColumn> = + exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun SingleColumn>.exceptNew(vararg others: String): SingleColumn> = + exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun SingleColumn>.exceptNew(other: KProperty): SingleColumn> = + exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun SingleColumn>.exceptNew(vararg others: KProperty<*>): SingleColumn> = + exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun SingleColumn>.exceptNew(other: ColumnPath): SingleColumn> = + exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun SingleColumn>.exceptNew(vararg others: ColumnPath): SingleColumn> = + exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun String.exceptNew(selector: ColumnsSelector<*, *>): SingleColumn> = + columnGroup(this).exceptNew(selector) + + @ExperimentalExceptCsDsl + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith("exceptNew { other }"), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public infix fun String.exceptNew(other: ColumnsResolver<*>): SingleColumn> = + exceptNew { other } + + @ExperimentalExceptCsDsl + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith("exceptNew { others.toColumnSet() }"), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun String.exceptNew(vararg others: ColumnsResolver<*>): SingleColumn> = + exceptNew { others.toColumnSet() } + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun String.exceptNew(other: String): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun String.exceptNew(vararg others: String): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun String.exceptNew(other: KProperty<*>): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun String.exceptNew(vararg others: KProperty<*>): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun String.exceptNew(other: ColumnPath): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun String.exceptNew(vararg others: ColumnPath): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun KProperty.exceptNew(selector: ColumnsSelector): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(selector.toColumns()) + + @ExperimentalExceptCsDsl + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith("exceptNew { other }"), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public infix fun KProperty<*>.exceptNew(other: ColumnsResolver<*>): SingleColumn> = + exceptNew { other } + + @ExperimentalExceptCsDsl + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith("exceptNew { others.toColumnSet() }"), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun KProperty<*>.exceptNew(vararg others: ColumnsResolver<*>): SingleColumn> = + exceptNew { others.toColumnSet() } + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun KProperty.exceptNew(other: String): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun KProperty.exceptNew(vararg others: String): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("KPropertyDataRowExceptNew") + public infix fun KProperty>.exceptNew(other: String): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("KPropertyDataRowExceptNew") + public fun KProperty>.exceptNew(vararg others: String): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun KProperty.exceptNew(other: KProperty<*>): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun KProperty.exceptNew(vararg others: KProperty<*>): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("KPropertyDataRowExceptNew") + public infix fun KProperty>.exceptNew(other: KProperty<*>): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("KPropertyDataRowExceptNew") + public fun KProperty>.exceptNew(vararg others: KProperty<*>): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun KProperty.exceptNew(other: ColumnPath): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun KProperty.exceptNew(vararg others: ColumnPath): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("KPropertyDataRowExceptNew") + public infix fun KProperty>.exceptNew(other: ColumnPath): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("KPropertyDataRowExceptNew") + public fun KProperty>.exceptNew(vararg others: ColumnPath): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun ColumnPath.exceptNew(selector: ColumnsSelector<*, *>): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(selector.toColumns()) + + @ExperimentalExceptCsDsl + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith("exceptNew { other }"), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public infix fun ColumnPath.exceptNew(other: ColumnsResolver<*>): SingleColumn> = + exceptNew { other } + + @ExperimentalExceptCsDsl + @Deprecated( + message = ALL_COLS_EXCEPT, + replaceWith = ReplaceWith("exceptNew { others.toColumnSet() }"), + level = DeprecationLevel.ERROR, + ) // present solely to redirect users to the right function + public fun ColumnPath.exceptNew(vararg others: ColumnsResolver<*>): SingleColumn> = + exceptNew { others.toColumnSet() } + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun ColumnPath.exceptNew(other: String): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun ColumnPath.exceptNew(vararg others: String): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun ColumnPath.exceptNew(other: KProperty<*>): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + @ExperimentalExceptCsDsl + public fun ColumnPath.exceptNew(vararg others: KProperty<*>): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public infix fun ColumnPath.exceptNew(other: ColumnPath): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(column(other)) + + /** + * ## EXPERIMENTAL: Except on Column Group + * + * Selects the current column group itself, except for the specified columns. This is different from + * [allColsExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] in that it does not 'lift' the columns out of the group, but instead selects the group itself. + * + * As usual, all overloads for each [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] are available. + * + * These produce the same result: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup) `[except][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.except]` colGroup.col }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroup `[exceptNew][SingleColumn.except]` { col } }` + * + * These functions are experimental and may be removed or changed in the future. + * + * Trying these functions requires you to `@`[`OptIn`][OptIn]`(`[ExperimentalExceptCsDsl][org.jetbrains.kotlinx.dataframe.api.ExperimentalExceptCsDsl]`::class)` first. + * + * ## NOTE: + * `exceptNew` will likely be renamed to `except` when the deprecated [SingleColumn.except] functions + * are deleted. + */ + @ExperimentalExceptCsDsl + public fun ColumnPath.exceptNew(vararg others: ColumnPath): SingleColumn> = + columnGroup(this).exceptExperimentalInternal(others.toColumnSet()) + + // endregion +} + +/** + * Removes the columns in the "other" ColumnsResolver from the current ColumnSet while keeping the structure intact. + * Returns a new ColumnSet with the remaining columns. + * + * @param other The ColumnsResolver containing the columns to be removed. + * @return The new ColumnSet with the remaining columns. + */ +@Suppress("UNCHECKED_CAST") +internal fun ColumnSet.exceptInternal(other: ColumnsResolver<*>): ColumnSet = + createColumnSet { context -> + val resolvedCols = this.resolve(context) + val resolvedColsToExcept = other.resolve(context) + resolvedCols.allColumnsExceptKeepingStructure(resolvedColsToExcept) + } as ColumnSet + +/** + * Returns a new ColumnSet that contains all columns from inside the receiver column group + * except those specified in the "other" ColumnsResolver. + * + * @param other The ColumnsResolver containing the columns to be removed. + * @return The new ColumnSet with the remaining columns. + */ +internal fun SingleColumn>.allColsExceptInternal(other: ColumnsResolver<*>): ColumnSet = + selectInternal { all().exceptInternal(other) } + +/** + * Returns a new SingleColumn> that has the same structure as the receiver, but excludes columns + * specified in the "other" ColumnsResolver. + * + * @param other The [ColumnsResolver] to use for excluding columns. + * @return A new [SingleColumn] with the filtered columns excluded. + */ +@Suppress("UNCHECKED_CAST") +internal fun SingleColumn>.exceptExperimentalInternal( + other: ColumnsResolver<*>, +): SingleColumn> = + ensureIsColumnGroup().transformSingle { singleCol -> + val columnsToExcept = singleCol + .asColumnGroup() + .getColumnsWithPaths { other } + .map { it.changePath(singleCol.path + it.path) } + + val newCols = listOf(singleCol).allColumnsExceptKeepingStructure(columnsToExcept) + + newCols as List>> + }.singleInternal() as SingleColumn> + +/** + * Functions annotated with this annotation are experimental and will be removed or renamed in the future. + */ +@RequiresOptIn(level = RequiresOptIn.Level.ERROR) +@Target(AnnotationTarget.FUNCTION) +public annotation class ExperimentalExceptCsDsl + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/and.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/and.kt new file mode 100644 index 000000000..2bd106c4b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/and.kt @@ -0,0 +1,647 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnsList +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## And [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface AndColumnsSelectionDsl { + + /** + * ## And Operator Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `columnOrSet: `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]` `[**`and`**][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` [ `**`{`**` ] `[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]` [ `**`}`**` ]` + * + * `| `[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]__`.`__[**`and`**][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]**` (`**`|`**`{ `**[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]**` }`**`|`**`)`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`and`**][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]**` (`**`|`**`{ `**[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]**` }`**`|`**`)`** + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`and`**][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]**` (`**`|`**`{ `**[`columnOrSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnOrColumnSetDef]**` }`**`|`**`)`** + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`and`**][ColumnsSelectionDsl.and] */ + public interface InfixName + + /** __`.`__[**`and`**][ColumnsSelectionDsl.and] */ + public interface Name + } + + /** + * ## And Operator + * The [and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][DataFrame.groupBy]` { "colA" `[`and`][String.and]` colB }` + * + * `df.`[`select`][DataFrame.select]` {` + * + *     [`colsOf`][SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][ColumnSet.and]` {` + * + *         [`colsAtAnyDepth`][ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][DataFrame.select]` { "colC" `[`and`][String.and]` Type::colB `[`and`][KProperty.and]` "pathTo"["colC"] `[`and`][ColumnPath.and]` colD }` + * + * #### Example for this overload: + * + * + * + * @return A [ColumnSet] that contains all the columns from the [ColumnsResolvers][ColumnsResolver] on the left + * and right side of the [and] operator. + */ + private interface CommonAndDocs { + + interface ExampleArg + } + + // region ColumnsResolver + + /** + * ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]` { ... } `[`and`][ColumnsResolver.and]` `` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + private interface ColumnsResolverAndDocs { + + interface Argument + } + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { ... } `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` `[`colsOf`][SingleColumn.colsOf]`<`[`Int`][Int]`>()`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + @Interpretable("And0") + public infix fun ColumnsResolver.and(other: ColumnsResolver): ColumnSet = ColumnsList(this, other) + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { ... } `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` ``{ colA `[`/`][DataColumn.div]` 2.0 `[`named`][ColumnReference.named]` "half colA" }`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun ColumnsResolver.and(other: () -> ColumnsResolver): ColumnSet = this and other() + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { ... } `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` ``"colB"`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun ColumnsResolver.and(other: String): ColumnSet<*> = this and other.toColumnAccessor() + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { ... } `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` ``Type::colB`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun ColumnsResolver.and(other: KProperty): ColumnSet = this and other.toColumnAccessor() + + // endregion + + // region String + + /** + * ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][DataFrame.select]` { "colA" `[`and`][String.and]` `` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + private interface StringAndDocs { + + interface Argument + } + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[`and`][kotlin.String.and]` `[`colsOf`][SingleColumn.colsOf]`<`[`Int`][Int]`>()`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun String.and(other: ColumnsResolver): ColumnSet<*> = toColumnAccessor() and other + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[`and`][kotlin.String.and]` ``{ colA `[`/`][DataColumn.div]` 2.0 `[`named`][ColumnReference.named]` "half colA" }`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun String.and(other: () -> ColumnsResolver): ColumnSet<*> = toColumnAccessor() and other() + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[`and`][kotlin.String.and]` ``"colB"`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun String.and(other: String): ColumnSet<*> = toColumnAccessor() and other.toColumnAccessor() + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[`and`][kotlin.String.and]` ``Type::colB`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun String.and(other: KProperty): ColumnSet<*> = toColumnAccessor() and other + + // endregion + + // region KProperty + + /** + * ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][DataFrame.select]` { Type::colA `[`and`][KProperty.and]` `` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + private interface KPropertyAndDocs { + + interface Argument + } + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::colA `[`and`][kotlin.reflect.KProperty.and]` `[`colsOf`][SingleColumn.colsOf]`<`[`Int`][Int]`>()`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun KProperty.and(other: ColumnsResolver): ColumnSet = toColumnAccessor() and other + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::colA `[`and`][kotlin.reflect.KProperty.and]` ``{ colA `[/][DataColumn.div]` 2.0 `[`named`][ColumnReference.named]` "half colA" }`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun KProperty.and(other: () -> ColumnsResolver): ColumnSet = + toColumnAccessor() and other() + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::colA `[`and`][kotlin.reflect.KProperty.and]` ``"colB"`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun KProperty.and(other: String): ColumnSet<*> = toColumnAccessor() and other + + /** ## And Operator + * The [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator allows you to combine selections of columns or simply select multiple columns at once. + * + * You can even mix and match any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[`groupBy`][org.jetbrains.kotlinx.dataframe.DataFrame.groupBy]` { "colA" `[`and`][kotlin.String.and]` colB }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     [`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`String`][String]`>() `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` {` + * + *         [`colsAtAnyDepth`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { "price" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }` + * + *     `}` + * + * `}` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colC" `[`and`][kotlin.String.and]` Type::colB `[`and`][kotlin.reflect.KProperty.and]` "pathTo"["colC"] `[`and`][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver.and]` colD }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::colA `[`and`][kotlin.reflect.KProperty.and]` ``Type::colB`` }` + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains all the columns from the [ColumnsResolvers][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver] on the left + * and right side of the [and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and] operator. + */ + public infix fun KProperty.and(other: KProperty): ColumnSet = + toColumnAccessor() and other.toColumnAccessor() + + // endregion +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/any.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/any.kt new file mode 100644 index 000000000..d8af3cf83 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/any.kt @@ -0,0 +1,19 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.Predicate +import org.jetbrains.kotlinx.dataframe.RowFilter +import org.jetbrains.kotlinx.dataframe.columns.values + +// region DataColumn + +public fun DataColumn.any(predicate: Predicate): Boolean = values.any(predicate) + +// endregion + +// region DataFrame + +public fun DataFrame.any(predicate: RowFilter): Boolean = rows().any { predicate(it, it) } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/append.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/append.kt new file mode 100644 index 000000000..6825337f6 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/append.kt @@ -0,0 +1,32 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.columns.values +import org.jetbrains.kotlinx.dataframe.impl.api.updateWith +import org.jetbrains.kotlinx.dataframe.ncol +import org.jetbrains.kotlinx.dataframe.nrow + +// region DataFrame + +public fun DataFrame.append(vararg values: Any?): DataFrame { + val ncol = ncol + check(values.size % ncol == 0) { + "Invalid number of arguments. Multiple of $ncol is expected, but actual was: ${values.size}" + } + val newRows = values.size / ncol + return columns().mapIndexed { colIndex, col -> + val newValues = (0 until newRows).map { values[colIndex + it * ncol] } + col.updateWith(col.values + newValues) + }.toDataFrame().cast() +} + +public fun DataFrame.appendNulls(numberOfRows: Int = 1): DataFrame { + require(numberOfRows >= 0) + if (numberOfRows == 0) return this + if (ncol == 0) return DataFrame.empty(nrow + numberOfRows).cast() + return columns().map { col -> + col.updateWith(col.values + arrayOfNulls(numberOfRows)) + }.toDataFrame().cast() +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/asIterable.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/asIterable.kt new file mode 100644 index 000000000..2b5c379f4 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/asIterable.kt @@ -0,0 +1,9 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn + +// region DataColumn + +public fun DataColumn.asIterable(): Iterable = values() + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/asSequence.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/asSequence.kt new file mode 100644 index 000000000..73af1ef41 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/asSequence.kt @@ -0,0 +1,17 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow + +// region DataColumn + +public fun DataColumn.asSequence(): Sequence = asIterable().asSequence() + +// endregion + +// region DataFrame + +public fun DataFrame.asSequence(): Sequence> = rows().asSequence() + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/associate.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/associate.kt new file mode 100644 index 000000000..3e6d9fb44 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/associate.kt @@ -0,0 +1,15 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression + +// region DataFrame + +public fun DataFrame.associateBy(transform: RowExpression): Map> = + rows().associateBy { transform(it, it) } + +public fun DataFrame.associate(transform: RowExpression>): Map = + rows().associate { transform(it, it) } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/between.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/between.kt new file mode 100644 index 000000000..3a37f9e7d --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/between.kt @@ -0,0 +1,14 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.impl.between + +// region DataColumn + +public fun > DataColumn.between( + left: T, + right: T, + includeBoundaries: Boolean = true, +): DataColumn = map { it.between(left, right, includeBoundaries) } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cast.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cast.kt new file mode 100644 index 000000000..c8ba378c6 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cast.kt @@ -0,0 +1,71 @@ +@file:Suppress("UNCHECKED_CAST") + +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.annotations.Check +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.ValueColumn +import org.jetbrains.kotlinx.dataframe.impl.api.convertToImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableSingleColumn +import kotlin.reflect.typeOf + +@Check +public fun AnyFrame.cast(): DataFrame = this as DataFrame + +public inline fun AnyFrame.cast(verify: Boolean = true): DataFrame = + if (verify) { + convertToImpl( + typeOf(), + allowConversion = false, + ExcessiveColumns.Keep, + ).cast() + } else { + cast() + } + +public inline fun AnyFrame.castTo( + @Suppress("UNUSED_PARAMETER") schemaFrom: DataFrame, + verify: Boolean = true, +): DataFrame = cast(verify = verify) + +public fun AnyRow.cast(): DataRow = this as DataRow + +public inline fun AnyRow.cast(verify: Boolean = true): DataRow = df().cast(verify)[0] + +public fun AnyCol.cast(): DataColumn = this as DataColumn + +public fun ValueColumn<*>.cast(): ValueColumn = this as ValueColumn + +public fun FrameColumn<*>.castFrameColumn(): FrameColumn = this as FrameColumn + +public fun ColumnGroup<*>.cast(): ColumnGroup = this as ColumnGroup + +public fun ColumnWithPath<*>.cast(): ColumnWithPath = this as ColumnWithPath + +public fun ColumnAccessor<*>.cast(): ColumnAccessor = this as ColumnAccessor + +public fun ColumnSet<*>.cast(): ColumnSet = this as ColumnSet + +public fun ColumnsResolver<*>.cast(): ColumnsResolver = this as ColumnsResolver + +public fun SingleColumn<*>.cast(): SingleColumn = this as SingleColumn + +public fun TransformableColumnSet<*>.cast(): TransformableColumnSet = this as TransformableColumnSet + +public fun TransformableSingleColumn<*>.cast(): TransformableSingleColumn = this as TransformableSingleColumn + +public fun ColumnReference<*>.cast(): ColumnReference = this as ColumnReference diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/chunked.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/chunked.kt new file mode 100644 index 000000000..67f3dec6d --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/chunked.kt @@ -0,0 +1,25 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.ValueColumn +import org.jetbrains.kotlinx.dataframe.impl.getListType +import org.jetbrains.kotlinx.dataframe.nrow +import org.jetbrains.kotlinx.dataframe.type + +public fun DataFrame.chunked(size: Int, name: String = "groups"): FrameColumn { + val startIndices = (0 until nrow step size) + return DataColumn.createFrameColumn(name, this, startIndices) +} + +public fun DataColumn.chunked(size: Int): ValueColumn> { + val values = toList().chunked(size) + return DataColumn.createValueColumn(name(), values, getListType(type)) +} + +public fun ColumnGroup.chunked(size: Int): FrameColumn = chunked(size, name()) + +public fun DataColumn>.chunked(size: Int): FrameColumn = asColumnGroup().chunked(size) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/col.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/col.kt new file mode 100644 index 000000000..813aa781c --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/col.kt @@ -0,0 +1,3005 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnGroupAccessor +import org.jetbrains.kotlinx.dataframe.ColumnGroupReference +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.getAt +import org.jetbrains.kotlinx.dataframe.impl.columns.singleImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle +import org.jetbrains.kotlinx.dataframe.util.COL_REPLACE +import org.jetbrains.kotlinx.dataframe.util.IDENTITY_FUNCTION +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Col [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + * @param _UNUSED [#KT-68546](https://youtrack.jetbrains.com/issue/KT-68546/Conflicting-overloads-in-non-generic-interface-K2-2.0.0) + */ +public interface ColColumnsSelectionDsl { + + /** + * ## Col Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `index: `[`Int`][Int] + * + *      + * + * `T: Column type` + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`col`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`col`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]**`(`**[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`**` | `[**`[`**][ColumnsSelectionDsl.col][`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef][**`]`**][ColumnsSelectionDsl.col] + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`col`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`col`**][ColumnsSelectionDsl.col] */ + public interface PlainDslName + + /** __`.`__[**`col`**][ColumnsSelectionDsl.col] */ + public interface ColumnSetName + + /** __`.`__[**`col`**][ColumnsSelectionDsl.col] */ + public interface ColumnGroupName + } + + /** + * ## Col + * + * Creates a [ColumnAccessor] (or [SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath], [KProperty], or [ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { `[col][col]`<`[String][String]`>("colA") }` + * + * `df.`[select][DataFrame.select]` { `[col][col]`(SomeType::colB) }` + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[col][col]`(1) }` + * + * #### Examples for this overload: + * + * + * + * To create a [ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][ColumnsSelectionDsl.valueCol], + * [colGroup][ColumnsSelectionDsl.colGroup], + * and [frameCol][ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + */ + private interface CommonColDocs { + + // Example argument, can be either {@include [SingleExample]} or {@include [DoubleExample]} + interface ExampleArg + + /** + * `df.`[select][DataFrame.select]` { `[col][col]`() }` + */ + interface SingleExample + + /** + * `df.`[select][DataFrame.select]` { `[col][col]`() }` + * + * `df.`[select][DataFrame.select]` { `[col][col]`<`[String][String]`>() }` + */ + interface DoubleExample + + // Receiver argument for the example(s) + interface ReceiverArg + + // Argument for the example(s) + interface Arg + + // Optional note + interface Note + + /** @param [C] The type of the column. */ + interface ColumnTypeParam + } + + // region reference + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [col] The [ColumnAccessor] pointing to the column. + * @param [C] The type of the column. + */ + private interface ColReferenceDocs + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * NOTE: This overload is an identity function and can be omitted. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the column. + * @param [C] The type of the column. + * + */ + @Deprecated(IDENTITY_FUNCTION, ReplaceWith(COL_REPLACE)) + public fun col(col: ColumnAccessor): ColumnAccessor = col + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the column. + * @param [C] The type of the column. + */ + public fun SingleColumn>.col(col: ColumnAccessor): SingleColumn = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(col) + ?: throw IllegalStateException("Column '${col.path()}' not found in column group '${it.path}'") + listOf(child) + }.singleImpl() + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the column. + * @param [C] The type of the column. + */ + public fun AnyColumnGroupAccessor.col(col: ColumnAccessor): ColumnAccessor = + this.ensureIsColumnGroup().column(col.path()) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the column. + * @param [C] The type of the column. + */ + public fun String.col(col: ColumnAccessor): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(col.path()) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the column. + * @param [C] The type of the column. + */ + public fun KProperty<*>.col(col: ColumnAccessor): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(col.path()) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the column. + * @param [C] The type of the column. + */ + public fun ColumnPath.col(col: ColumnAccessor): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(col.path()) + + // endregion + + // region name + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + */ + private interface ColNameDocs + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun col(name: String): ColumnAccessor<*> = column(name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + * @param [C] The type of the column. + */ + public fun col(name: String): ColumnAccessor = column(name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun SingleColumn>.col(name: String): SingleColumn<*> = col(name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + * @param [C] The type of the column. + */ + public fun SingleColumn>.col(name: String): SingleColumn = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(name)?.cast() + ?: throw IllegalStateException("Column '$name' not found in column group '${it.path}'") + listOf(child) + }.singleImpl() + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun AnyColumnGroupAccessor.col(name: String): ColumnAccessor<*> = col(name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + * @param [C] The type of the column. + */ + public fun AnyColumnGroupAccessor.col(name: String): ColumnAccessor = this.ensureIsColumnGroup().column(name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun String.col(name: String): ColumnAccessor<*> = col(name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + * @param [C] The type of the column. + */ + public fun String.col(name: String): ColumnAccessor = + columnGroup(this) + .ensureIsColumnGroup() + .column(name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun KProperty<*>.col(name: String): ColumnAccessor<*> = col(name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + * @param [C] The type of the column. + */ + public fun KProperty<*>.col(name: String): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun ColumnPath.col(name: String): ColumnAccessor<*> = col(name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("columnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("columnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [name] The name of the column. + * @param [C] The type of the column. + */ + public fun ColumnPath.col(name: String): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(name) + + // endregion + + // region path + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + */ + private interface ColPathDocs + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun col(path: ColumnPath): ColumnAccessor<*> = column(path) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + * @param [C] The type of the column. + */ + public fun col(path: ColumnPath): ColumnAccessor = column(path) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun SingleColumn>.col(path: ColumnPath): SingleColumn<*> = col(path) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + * @param [C] The type of the column. + */ + public fun SingleColumn>.col(path: ColumnPath): SingleColumn = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(path)?.cast() + ?: throw IllegalStateException("Column '$path' not found in column group '${it.path}'") + listOf(child) + }.singleImpl() + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun AnyColumnGroupAccessor.col(path: ColumnPath): ColumnAccessor<*> = col(path) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + * @param [C] The type of the column. + */ + public fun AnyColumnGroupAccessor.col(path: ColumnPath): ColumnAccessor = + this.ensureIsColumnGroup().column(path) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun String.col(path: ColumnPath): ColumnAccessor<*> = col(path) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + * @param [C] The type of the column. + */ + public fun String.col(path: ColumnPath): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(path) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun KProperty<*>.col(path: ColumnPath): ColumnAccessor<*> = col(path) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + * @param [C] The type of the column. + */ + public fun KProperty<*>.col(path: ColumnPath): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(path) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun ColumnPath.col(path: ColumnPath): ColumnAccessor<*> = col(path) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`("pathTo"["columnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("pathTo"["columnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [path] The path to the column. + * @param [C] The type of the column. + */ + public fun ColumnPath.col(path: ColumnPath): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(path) + + // endregion + + // region property + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(Type::columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [property] The [KProperty] reference to the column. + * @param [C] The type of the column. + */ + private interface ColKPropertyDocs + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(Type::columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [property] The [KProperty] reference to the column. + * @param [C] The type of the column. + */ + public fun col(property: KProperty): SingleColumn = column(property) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(Type::columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [property] The [KProperty] reference to the column. + * @param [C] The type of the column. + */ + public fun SingleColumn>.col(property: KProperty): SingleColumn = col(property.name) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(Type::columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [property] The [KProperty] reference to the column. + * @param [C] The type of the column. + */ + public fun AnyColumnGroupAccessor.col(property: KProperty): ColumnAccessor = + this.ensureIsColumnGroup().column(property) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(Type::columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [property] The [KProperty] reference to the column. + * @param [C] The type of the column. + */ + public fun String.col(property: KProperty): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(property) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(Type::columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [property] The [KProperty] reference to the column. + * @param [C] The type of the column. + */ + public fun KProperty<*>.col(property: KProperty): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(property) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(Type::columnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [property] The [KProperty] reference to the column. + * @param [C] The type of the column. + */ + public fun ColumnPath.col(property: KProperty): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().column(property) + + // endregion + + // region index + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + private interface ColIndexDocs + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * NOTE: You can use the get-[] operator on [ColumnSets][ColumnSet] as well! + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[String][String]`>()`[`[`][col]`1`[`]`][col]` }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column. + * + * + */ + public fun ColumnSet.col(index: Int): SingleColumn = getAt(index) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[String][String]`>()`[`[`][col]`1`[`]`][col]` }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column. + * + */ + public operator fun ColumnSet.get(index: Int): SingleColumn = col(index) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun ColumnsSelectionDsl<*>.col(index: Int): SingleColumn<*> = col(index) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column. + */ + public fun ColumnsSelectionDsl<*>.col(index: Int): SingleColumn = asSingleColumn().col(index) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun SingleColumn>.col(index: Int): SingleColumn<*> = col(index) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column. + */ + public fun SingleColumn>.col(index: Int): SingleColumn = + this.ensureIsColumnGroup() + .allColumnsInternal() + .getAt(index) + .cast() + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun String.col(index: Int): SingleColumn<*> = col(index) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column. + */ + public fun String.col(index: Int): SingleColumn = columnGroup(this).col(index) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun KProperty<*>.col(index: Int): SingleColumn<*> = col(index) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column. + */ + public fun KProperty<*>.col(index: Int): SingleColumn = columnGroup(this).col(index) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colUnTyped") + public fun ColumnPath.col(index: Int): SingleColumn<*> = col(index) + + /** + * ## Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [column][org.jetbrains.kotlinx.dataframe.api.column] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>("colA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(SomeType::colB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[col][org.jetbrains.kotlinx.dataframe.api.ColColumnsSelectionDsl.col]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for a specific kind of column with runtime checks, take a look at the functions + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * + * @see [column] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * + * + * + * @param [index] The index of the column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column. + */ + public fun ColumnPath.col(index: Int): SingleColumn = columnGroup(this).col(index) + + // endregion +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroup.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroup.kt new file mode 100644 index 000000000..da08ed0b4 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroup.kt @@ -0,0 +1,3473 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnGroupAccessor +import org.jetbrains.kotlinx.dataframe.ColumnGroupReference +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.getAt +import org.jetbrains.kotlinx.dataframe.impl.columns.onResolve +import org.jetbrains.kotlinx.dataframe.impl.columns.singleImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Column Group [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + * @param _UNUSED [#KT-68546](https://youtrack.jetbrains.com/issue/KT-68546/Conflicting-overloads-in-non-generic-interface-K2-2.0.0) + */ +public interface ColGroupColumnsSelectionDsl { + + /** + * ## Col Group Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `index: `[`Int`][Int] + * + *      + * + * `T: Column type` + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`colGroup`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`colGroup`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]**`(`**[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`colGroup`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`colGroup`**][ColumnsSelectionDsl.colGroup] */ + public interface PlainDslName + + /** __`.`__[**`colGroup`**][ColumnsSelectionDsl.colGroup] */ + public interface ColumnSetName + + /** __`.`__[**`colGroup`**][ColumnsSelectionDsl.colGroup] */ + public interface ColumnGroupName + } + + /** + * ## Col Group + * + * Creates a [ColumnAccessor] (or [SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath], [KProperty], or [ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { `[colGroup][colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][DataFrame.select]` { `[colGroup][colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[colGroup][colGroup]`(1) }` + * + * #### Examples for this overload: + * + * + * + * To create a [ColumnAccessor] for another kind of column, take a look at the functions + * [col][ColumnsSelectionDsl.col], + * [valueCol][ColumnsSelectionDsl.valueCol], + * and [frameCol][ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + */ + private interface CommonColGroupDocs { + + // Example argument, can be either {@include [SingleExample]} or {@include [DoubleExample]} + interface ExampleArg + + /** + * `df.`[select][DataFrame.select]` { `[colGroup][colGroup]`() }` + */ + interface SingleExample + + /** + * `df.`[select][DataFrame.select]` { `[colGroup][colGroup]`() }` + * + * `df.`[select][DataFrame.select]` { `[colGroup][colGroup]`<`[String][String]`>() }` + */ + interface DoubleExample + + // Receiver argument for the example(s) + interface ReceiverArg + + // Argument for the example(s) + interface Arg + + // Optional note + interface Note + + /** @param [C] The type of the column group. */ + interface ColumnGroupTypeParam + } + + // region reference + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor] pointing to the value column. + * @param [C] The type of the column group. + */ + private interface ColGroupReferenceDocs + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the column group. + */ + public fun colGroup(colGroup: ColumnAccessor>): ColumnAccessor> = + colGroup.ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the column group. + */ + public fun SingleColumn>.colGroup(colGroup: ColumnAccessor>): SingleColumn> = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(colGroup) + ?: throw IllegalStateException( + "ColumnGroup '${colGroup.path()}' not found in column group '${it.path}'", + ) + child.data.ensureIsColumnGroup() + listOf(child) + }.singleImpl() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the column group. + */ + public fun AnyColumnGroupAccessor.colGroup(colGroup: ColumnAccessor>): ColumnAccessor> = + this.ensureIsColumnGroup().columnGroup(colGroup.path()).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the column group. + */ + public fun String.colGroup(colGroup: ColumnAccessor>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(colGroup.path()).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the column group. + */ + public fun KProperty<*>.colGroup(colGroup: ColumnAccessor>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(colGroup.path()).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the column group. + */ + public fun ColumnPath.colGroup(colGroup: ColumnAccessor>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(colGroup.path()).ensureIsColumnGroup() + + // endregion + + // region name + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + private interface ColGroupNameDocs + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun colGroup(name: String): ColumnAccessor> = columnGroup(name).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the column group. + */ + public fun colGroup(name: String): ColumnAccessor> = columnGroup(name).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun SingleColumn>.colGroup(name: String): SingleColumn> = colGroup(name) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the column group. + */ + public fun SingleColumn>.colGroup(name: String): SingleColumn> = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(name)?.cast>() + ?: throw IllegalStateException("Column group '$name' not found in column group '${it.path}'") + child.data.ensureIsColumnGroup() + listOf(child) + }.singleImpl() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun AnyColumnGroupAccessor.colGroup(name: String): ColumnAccessor> = colGroup(name) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the column group. + */ + public fun AnyColumnGroupAccessor.colGroup(name: String): ColumnAccessor> = + this.ensureIsColumnGroup().columnGroup(name).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun String.colGroup(name: String): ColumnAccessor> = colGroup(name) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the column group. + */ + public fun String.colGroup(name: String): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(name).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun KProperty<*>.colGroup(name: String): ColumnAccessor> = colGroup(name) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the column group. + */ + public fun KProperty<*>.colGroup(name: String): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(name).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun ColumnPath.colGroup(name: String): ColumnAccessor> = colGroup(name) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("columnGroupName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("columnGroupName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the column group. + */ + public fun ColumnPath.colGroup(name: String): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(name).ensureIsColumnGroup() + + // endregion + + // region path + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + private interface ColGroupPathDocs + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun colGroup(path: ColumnPath): ColumnAccessor> = columnGroup(path).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the column group. + */ + public fun colGroup(path: ColumnPath): ColumnAccessor> = columnGroup(path).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun SingleColumn>.colGroup(path: ColumnPath): SingleColumn> = colGroup(path) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the column group. + */ + public fun SingleColumn>.colGroup(path: ColumnPath): SingleColumn> = + this.ensureIsColumnGroup() + .transformSingle { + val child = it.getCol(path)?.cast>() + ?: throw IllegalStateException("Column group '$path' not found in column group '${it.path}'") + child.data.ensureIsColumnGroup() + listOf(child) + }.singleImpl() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun AnyColumnGroupAccessor.colGroup(path: ColumnPath): ColumnAccessor> = colGroup(path) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the column group. + */ + public fun AnyColumnGroupAccessor.colGroup(path: ColumnPath): ColumnAccessor> = + this.ensureIsColumnGroup().columnGroup(path).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun String.colGroup(path: ColumnPath): ColumnAccessor> = colGroup(path) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the column group. + */ + public fun String.colGroup(path: ColumnPath): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(path).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun KProperty<*>.colGroup(path: ColumnPath): ColumnAccessor> = colGroup(path) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the column group. + */ + public fun KProperty<*>.colGroup(path: ColumnPath): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(path).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun ColumnPath.colGroup(path: ColumnPath): ColumnAccessor> = colGroup(path) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`("pathTo"["columnGroupName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("pathTo"["columnGroupName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the column group. + */ + public fun ColumnPath.colGroup(path: ColumnPath): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(path).ensureIsColumnGroup() + + // endregion + + // region property + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + private interface ColGroupKPropertyDocs + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupDataRowKProperty") + public fun colGroup(property: KProperty>): SingleColumn> = + columnGroup(property).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + public fun colGroup(property: KProperty): SingleColumn> = + columnGroup(property).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupDataRowKProperty") + public fun SingleColumn>.colGroup(property: KProperty>): SingleColumn> = + colGroup(property.name) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + public fun SingleColumn>.colGroup(property: KProperty): SingleColumn> = + colGroup(property.name) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupDataRowKProperty") + public fun AnyColumnGroupAccessor.colGroup(property: KProperty>): ColumnAccessor> = + this.ensureIsColumnGroup().columnGroup(property).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + public fun AnyColumnGroupAccessor.colGroup(property: KProperty): ColumnAccessor> = + this.ensureIsColumnGroup().columnGroup(property).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupDataRowKProperty") + public fun String.colGroup(property: KProperty>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(property).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + public fun String.colGroup(property: KProperty): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(property).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupDataRowKProperty") + public fun KProperty<*>.colGroup(property: KProperty>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(property).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + public fun KProperty<*>.colGroup(property: KProperty): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(property).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupDataRowKProperty") + public fun ColumnPath.colGroup(property: KProperty>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(property).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(Type::columnGroupA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the column group. + */ + public fun ColumnPath.colGroup(property: KProperty): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().columnGroup(property).ensureIsColumnGroup() + + // endregion + + // region index + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + private interface ColGroupIndexDocs + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column group. + * + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("ColumnSetDataRowColGroupIndex") + public fun ColumnSet>.colGroup(index: Int): SingleColumn> = + getAt(index).ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column group. + * + */ + public fun ColumnSet<*>.colGroup(index: Int): SingleColumn> = + getAt(index).cast>().ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun ColumnsSelectionDsl<*>.colGroup(index: Int): SingleColumn> = colGroup(index) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column group. + */ + public fun ColumnsSelectionDsl<*>.colGroup(index: Int): SingleColumn> = + asSingleColumn().colGroup(index) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun SingleColumn>.colGroup(index: Int): SingleColumn> = colGroup(index) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column group. + */ + public fun SingleColumn>.colGroup(index: Int): SingleColumn> = + this.ensureIsColumnGroup() + .allColumnsInternal() + .getAt(index) + .cast>() + .ensureIsColumnGroup() + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun String.colGroup(index: Int): SingleColumn> = colGroup(index) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column group. + */ + public fun String.colGroup(index: Int): SingleColumn> = columnGroup(this).colGroup(index) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun KProperty<*>.colGroup(index: Int): SingleColumn> = colGroup(index) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column group. + */ + public fun KProperty<*>.colGroup(index: Int): SingleColumn> = columnGroup(this).colGroup(index) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colGroupUnTyped") + public fun ColumnPath.colGroup(index: Int): SingleColumn> = colGroup(index) + + /** + * ## Col Group + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a column group with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [columnGroup][org.jetbrains.kotlinx.dataframe.api.columnGroup] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a column group. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a column group inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>("colGroupA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(SomeType::colGroupB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[colGroup][org.jetbrains.kotlinx.dataframe.api.ColGroupColumnsSelectionDsl.colGroup]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the column group with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a column group. + * + * @see [columnGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the column group. + */ + public fun ColumnPath.colGroup(index: Int): SingleColumn> = columnGroup(this).colGroup(index) + + // endregion +} + +/** + * Checks the validity of this [SingleColumn], + * by adding a check to see it's a [ColumnGroup] (so, a [SingleColumn]<*>) + * and throwing an [IllegalArgumentException] if it's not. + */ +@PublishedApi +internal fun SingleColumn>.ensureIsColumnGroup(): SingleColumn> = + onResolve { col: ColumnWithPath<*>? -> + require(col?.isColumnGroup() != false) { + "Column at '${col?.path?.joinToString()}' is not a ColumnGroup, but a ${col?.kind()}." + } + } + +/** Checks the validity of this [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn], + * by adding a check to see it's a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] (so, a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]<*>) + * and throwing an [IllegalArgumentException] if it's not. */ +internal fun ColumnAccessor>.ensureIsColumnGroup(): ColumnAccessor> = + onResolve { col: ColumnWithPath<*>? -> + require(col?.isColumnGroup() != false) { + "Column at '${col?.path?.joinToString()}' is not a ColumnGroup, but a ${col?.kind()}." + } + } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroups.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroups.kt new file mode 100644 index 000000000..192d2b212 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colGroups.kt @@ -0,0 +1,363 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Predicate +import org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.documentation.AccessApi +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Column Groups [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface ColGroupsColumnsSelectionDsl { + + /** + * ## Column Groups Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`colGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`colGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`colGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`colGroups`**][ColumnsSelectionDsl.colGroups] */ + public interface PlainDslName + + /** __`.`__[**`colGroups`**][ColumnsSelectionDsl.colGroups] */ + public interface ColumnSetName + + /** __`.`__[**`colGroups`**][ColumnsSelectionDsl.colGroups] */ + public interface ColumnGroupName + } + + /** + * ## Column Groups + * Creates a subset of columns from [this] that are [ColumnGroups][ColumnGroup]. + * + * You can optionally use a [filter] to only include certain columns. + * [colGroups] can be called using any of the supported [APIs][AccessApi] (+ [ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { `[colGroups][ColumnsSelectionDsl.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { `[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]`().`[colGroups][ColumnsSelectionDsl.colGroups]`() }` + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[colGroups][String.colGroups]`() }` + * + * #### Examples for this overload: + * + * + * + * @param [filter] An optional [predicate][Predicate] to filter the column groups by. + * @return A [ColumnSet] of [ColumnGroups][ColumnGroup]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.valueCols] + */ + private interface CommonColGroupsDocs { + + /** Example argument */ + interface ExampleArg + } + + /** + * ## Column Groups + * Creates a subset of columns from [this] that are [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * You can optionally use a [filter] to only include certain columns. + * [colGroups][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.colGroups] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colGroups][kotlin.String.colGroups]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") }.`[colGroups][ColumnSet.colGroups]`() }` + * + * `// NOTE: This can be shortened to just:` + * + * `df.`[select][DataFrame.select]` { `[colGroups][ColumnsSelectionDsl.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the column groups by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.valueCols] + */ + public fun ColumnSet<*>.colGroups(filter: Predicate> = { true }): TransformableColumnSet = + columnGroupsInternal(filter) + + /** + * ## Column Groups + * Creates a subset of columns from [this] that are [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * You can optionally use a [filter] to only include certain columns. + * [colGroups][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.colGroups] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colGroups][kotlin.String.colGroups]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colGroups][ColumnsSelectionDsl.colGroups]`() }` + * + * `df.`[select][DataFrame.select]` { `[colGroups][ColumnsSelectionDsl.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the column groups by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.valueCols] + */ + public fun ColumnsSelectionDsl<*>.colGroups( + filter: Predicate> = { true }, + ): TransformableColumnSet = asSingleColumn().columnGroupsInternal(filter) + + /** + * ## Column Groups + * Creates a subset of columns from [this] that are [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * You can optionally use a [filter] to only include certain columns. + * [colGroups][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.colGroups] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colGroups][kotlin.String.colGroups]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColGroup.`[colGroups][SingleColumn.colGroups]`() }` + * + * `df.`[select][DataFrame.select]` { myColGroup.`[colGroups][SingleColumn.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the column groups by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.valueCols] + */ + public fun SingleColumn>.colGroups( + filter: Predicate> = { true }, + ): TransformableColumnSet = this.ensureIsColumnGroup().columnGroupsInternal(filter) + + /** + * ## Column Groups + * Creates a subset of columns from [this] that are [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * You can optionally use a [filter] to only include certain columns. + * [colGroups][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.colGroups] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colGroups][kotlin.String.colGroups]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[colGroups][String.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[colGroups][String.colGroups]`() }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the column groups by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.valueCols] + */ + public fun String.colGroups(filter: Predicate> = { true }): TransformableColumnSet = + columnGroup(this).colGroups(filter) + + /** + * ## Column Groups + * Creates a subset of columns from [this] that are [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * You can optionally use a [filter] to only include certain columns. + * [colGroups][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.colGroups] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colGroups][kotlin.String.colGroups]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colGroup][ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[colGroups][SingleColumn.colGroups]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColGroup.`[colGroups][KProperty.colGroups]`() }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the column groups by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.valueCols] + */ + public fun KProperty<*>.colGroups(filter: Predicate> = { true }): TransformableColumnSet = + columnGroup(this).colGroups(filter) + + /** + * ## Column Groups + * Creates a subset of columns from [this] that are [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * You can optionally use a [filter] to only include certain columns. + * [colGroups][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.colGroups] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colGroups][kotlin.String.colGroups]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myGroupCol"].`[colGroups][ColumnPath.colGroups]`() }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the column groups by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ColumnGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.valueCols] + */ + public fun ColumnPath.colGroups(filter: Predicate> = { true }): TransformableColumnSet = + columnGroup(this).colGroups(filter) +} + +/** + * Returns a TransformableColumnSet containing the column groups that satisfy the given filter. + * + * @param filter The filter function to apply on each column group. Must accept a ColumnGroup object and return a Boolean. + * @return A [TransformableColumnSet] containing the column groups that satisfy the filter. + */ +@Suppress("UNCHECKED_CAST") +internal fun ColumnsResolver<*>.columnGroupsInternal( + filter: (ColumnGroup<*>) -> Boolean, +): TransformableColumnSet = colsInternal { it.isColumnGroup() && filter(it) } as TransformableColumnSet + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cols.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cols.kt new file mode 100644 index 000000000..ddf58b840 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cols.kt @@ -0,0 +1,4933 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.transform +import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle +import org.jetbrains.kotlinx.dataframe.impl.headPlusArray +import kotlin.reflect.KProperty + +/** + * ## Cols [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + * @param _UNUSED [#KT-68546](https://youtrack.jetbrains.com/issue/KT-68546/Conflicting-overloads-in-non-generic-interface-K2-2.0.0) + */ +public interface ColsColumnsSelectionDsl { + + /** + * ## Cols Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `index: `[`Int`][Int] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * `T: Column type` + * + *      + * + * `indexRange: `[`IntRange`][IntRange] + * + *      + * + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` .. | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`,`**` .. | `[`indexRange`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexRangeDef]**`)`** + * + * `| `[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` [ `**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` } `**`]` + * + * `| `**`this`**`/`**`it `**[**`[`**][cols]**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**[**`]`**][cols] + * + * `| `**`this`**`/`**`it `**[**`[`**][cols][`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` .. `[**`]`**][cols] + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]**`(`**[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`,`**` .. | `[`indexRange`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexRangeDef]**`)`** + * + *     `| `__`.`__[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` [ `**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` } `**`]` + * + *     `| `[**`[`**][cols]**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**[**`]`**][cols] + * + *     `| `[**`[`**][cols][`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`,`**` .. | `[`indexRange`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexRangeDef][**`]`**][cols]` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` .. | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`,`**` .. | `[`indexRange`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexRangeDef]**`)`** + * + *     `| `__`.`__[**`cols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` [ `**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` } `**`]` + * + *     `| `[**`[`**][cols]**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**[**`]`**][cols] + * + *     `| `[**`[`**][cols][`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`,`**` ..`[**`]`**][cols] + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`cols`**][ColumnsSelectionDsl.cols] */ + public interface PlainDslName + + /** __`.`__[**`cols`**][ColumnsSelectionDsl.cols] */ + public interface ColumnSetName + + /** __`.`__[**`cols`**][ColumnsSelectionDsl.cols] */ + public interface ColumnGroupName + } + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols] directly, you can also use the [`get`][ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar] + * + * #### For example: + * `df.`[`remove`][DataFrame.remove]` { `[`cols`][ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][DataFrame.select]` { myGroupCol.`[`cols`][SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][DataFrame.select]` { `[`colsOf`][ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][ColumnSet.cols]`1, 3, 5`[`]`][ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * + * + */ + private interface CommonColsDocs { + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][ColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][ColumnFilter] that takes a [ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + */ + interface Predicate + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * + * + * + * @param [firstCol] A that points to a relative column. + * @param [otherCols] Optional additional s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + interface Vararg { + + interface AccessorType + } + + /** Example argument */ + interface Examples + } + + /** + * ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][DataFrame.select]` { `[`colsOf`][ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][SingleColumn.get]`5, 1, 2`[`]`][SingleColumn.get]` }` + * + * `df.`[`select`][DataFrame.select]` { "myColumnGroup".`[`cols`][String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet] containing the columns found at the given indices. + */ + private interface CommonColsIndicesDocs { + + /** Example argument */ + interface ExampleArg + } + + /** + * ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][DataFrame.select]` { `[`colsOf`][ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][ColumnSet.cols]` }` + * + * `df.`[`select`][DataFrame.select]` { "myColGroup".`[`cols`][String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet] containing the columns found at the given indices. + */ + private interface CommonColsRangeDocs { + + /** Example argument */ + interface ExampleArg + } + + // region predicate + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `// although these can be shortened to just the `[`colsOf<>{ }`][ColumnsSelectionDsl.colsOf]` call` + * + * `df.`[`select`][DataFrame.select]` { `[`colsOf`][ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>().`[`cols`][ColumnSet.cols]` { "e" `[`in`][String.contains]` it.`[`name`][ColumnPath.name]`() } }` + * + * `df.`[`select`][DataFrame.select]` { `[`colsOf`][ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][ColumnSet.cols]`{ it.`[`any`][ColumnWithPath.any]` { it == "Alice" } }`[`]`][ColumnSet.cols]` }` + * + * `// identity call, same as `[`all`][ColumnsSelectionDsl.all]`()` + * + * `df.`[`select`][DataFrame.select]` { `[`colsOf`][ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>().`[`cols`][ColumnSet.cols]`() }` + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.all] + * @see [ColumnsSelectionDsl.filter] + */ + private interface ColumnSetColsPredicateDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `// although these can be shortened to just the `[`colsOf<>{ }`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]` call` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>().`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`{ it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } }`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `// identity call, same as `[`all`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`()` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>().`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`() }` + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.all] + * @see [ColumnsSelectionDsl.filter] */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.cols(predicate: ColumnFilter = { true }): TransformableColumnSet = + colsInternal(predicate as ColumnFilter<*>) as TransformableColumnSet + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `// although these can be shortened to just the `[`colsOf<>{ }`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]` call` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>().`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`{ it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } }`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `// identity call, same as `[`all`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`()` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>().`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`() }` + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.all] + * @see [ColumnsSelectionDsl.filter] */ + public operator fun ColumnSet.get(predicate: ColumnFilter = { true }): TransformableColumnSet = + cols(predicate) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]` { "e" `[`in`][String.contains]` it.`[`name`][ColumnPath.name]`() } }` + * + * `df.`[`select`][DataFrame.select]` { this`[`[`][ColumnsSelectionDsl.cols]`{ it.`[`any`][ColumnWithPath.any]` { it == "Alice" } }`[`]`][ColumnsSelectionDsl.cols]` }` + * + * `// same as `[`all`][ColumnsSelectionDsl.all]`()` + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`() }` + * + * + *      + * + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.all] + */ + private interface ColumnsSelectionDslColsPredicateDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`{ it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } }`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * `// same as `[`all`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`()` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() }` + * + * + *      + * + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.all] */ + public fun ColumnsSelectionDsl<*>.cols(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + this.asSingleColumn().colsInternal(predicate) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`{ it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } }`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * `// same as `[`all`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`()` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() }` + * + * + *      + * + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.all] */ + public operator fun ColumnsSelectionDsl<*>.get(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + cols(predicate) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup`.[`cols`][SingleColumn.cols]` { "e" `[`in`][String.contains]` it.`[`name`][ColumnPath.name]`() } }` + * + * `// same as `[`allCols`][ColumnsSelectionDsl.allCols]`()` + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup.`[`cols`][SingleColumn.cols]`() }` + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup`[`[`][SingleColumn.cols]`{ ... }`[`]`][SingleColumn.cols]` }` + * + *      + * + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.allCols] + */ + private interface SingleColumnAnyRowColsPredicateDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`.[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `// same as `[`allCols`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`() }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`{ ... }`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + *      + * + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.allCols] */ + public fun SingleColumn>.cols(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + this.ensureIsColumnGroup().colsInternal(predicate) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`.[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `// same as `[`allCols`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`() }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`{ ... }`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + *      + * + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.allCols] + */ + public operator fun SingleColumn>.get( + predicate: ColumnFilter<*> = { true }, + ): TransformableColumnSet<*> = cols(predicate) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "myGroupCol".`[`cols`][String.cols]` { "e" `[`in`][String.contains]` it.`[`name`][ColumnPath.name]`() } }` + * + * `df.`[`select`][DataFrame.select]` { "myGroupCol"`[`[`][String.cols]`{ it.`[`any`][ColumnWithPath.any]` { it == "Alice" } }`[`]`][String.cols]` }` + * + * `// same as `[`allCols`][ColumnsSelectionDsl.allCols]`()` + * + * `df.`[`select`][DataFrame.select]` { "myGroupCol".`[`cols`][String.cols]`() }` + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + */ + private interface StringColsPredicateDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol".`[`cols`][kotlin.String.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol"`[`[`][kotlin.String.cols]`{ it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } }`[`]`][kotlin.String.cols]` }` + * + * `// same as `[`allCols`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol".`[`cols`][kotlin.String.cols]`() }` + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + */ + public fun String.cols(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + columnGroup(this).cols(predicate) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol".`[`cols`][kotlin.String.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol"`[`[`][kotlin.String.cols]`{ it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } }`[`]`][kotlin.String.cols]` }` + * + * `// same as `[`allCols`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol".`[`cols`][kotlin.String.cols]`() }` + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + */ + public operator fun String.get(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = cols(predicate) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { Type::columnGroup.`[`cols`][KProperty.cols]` { "e" `[`in`][String.contains]` it.`[`name`][ColumnPath.name]`() } }` + * + * `df.`[`select`][DataFrame.select]` { Type::columnGroup`[`[`][SingleColumn.cols]`{ it.`[`any`][ColumnWithPath.any]` { it == "Alice" } }`[`]`][SingleColumn.cols]` }` + * + * `// same as `[`allCols`][ColumnsSelectionDsl.allCols]`()` + * + * `df.`[`select`][DataFrame.select]` { Type::columnGroup.`[`cols`][SingleColumn.cols]`() }` + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.allCols] + */ + private interface KPropertyColsPredicateDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnGroup.`[`cols`][kotlin.reflect.KProperty.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`{ it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } }`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * `// same as `[`allCols`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`() }` + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.allCols] */ + public fun KProperty<*>.cols(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + columnGroup(this).cols(predicate) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnGroup.`[`cols`][kotlin.reflect.KProperty.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`{ it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } }`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * `// same as `[`allCols`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols]`()` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`() }` + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.allCols] */ + public operator fun KProperty<*>.get(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + cols(predicate) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["myGroupCol"].`[`cols`][ColumnPath.cols]` { "e" `[`in`][String.contains]` it.`[`name`][ColumnPath.name]`() } }` + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["myGroupCol"]`[`[`][ColumnPath.cols]`{ it.`[`any`][ColumnWithPath.any]` { it == "Alice" } }`[`]`][ColumnPath.cols]` }` + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["myGroupCol"].`[`cols`][ColumnPath.cols]`() } // identity call, same as `[`allCols`][ColumnsSelectionDsl.allCols] + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + */ + private interface ColumnPathPredicateDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`{ it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } }`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`() } // identity call, same as `[`allCols`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols] + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + */ + public fun ColumnPath.cols(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + columnGroup(this).cols(predicate) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` { "e" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.name]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`{ it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } }`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`() } // identity call, same as `[`allCols`][org.jetbrains.kotlinx.dataframe.api.AllColumnsSelectionDsl.allCols] + * + * + * #### Filter vs. Cols: + * If used with a [predicate], `cols {}` functions exactly like [`filter {}`][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]. + * This is intentional, however; it is recommended to use `filter {}` on [ColumnSets][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] and + * `cols {}` on the rest. + * + * @param [predicate] A [ColumnFilter function][org.jetbrains.kotlinx.dataframe.ColumnFilter] that takes a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.filter] + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + */ + public operator fun ColumnPath.get(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + cols(predicate) + + // endregion + + // region references + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`(colGroup.columnA, columnB) }` + * + * `df.`[`select`][DataFrame.select]` { this`[`[`][ColumnsSelectionDsl.cols]`colGroup.columnA, columnB`[`]`][ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface ColumnsSelectionDslColsVarargColumnReferenceDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup.columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`colGroup.columnA, columnB`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun ColumnsSelectionDsl<*>.cols( + firstCol: ColumnReference, + vararg otherCols: ColumnReference, + ): ColumnSet = asSingleColumn().cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(colGroup.columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`colGroup.columnA, columnB`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun ColumnsSelectionDsl<*>.get( + firstCol: ColumnReference, + vararg otherCols: ColumnReference, + ): ColumnSet = cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup.`[`cols`][SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup`[`[`][SingleColumn.cols]`columnA, columnB`[`]`][SingleColumn.cols]` }` + * + * + * @param [firstCol] A [ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface SingleColumnColsVarargColumnReferenceDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`columnA, columnB`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun SingleColumn>.cols( + firstCol: ColumnReference, + vararg otherCols: ColumnReference, + ): ColumnSet = colsInternal(listOf(firstCol, *otherCols)).cast() + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`columnA, columnB`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun SingleColumn>.get( + firstCol: ColumnReference, + vararg otherCols: ColumnReference, + ): ColumnSet = cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "myColumnGroup".`[`cols`][String.cols]`(columnA, columnB) }` + * + * `df.`[`select`][DataFrame.select]` { "myColumnGroup"`[`[`][String.cols]`columnA, columnB`[`]`][String.cols]` }` + * + * + * @param [firstCol] A [ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface StringColsVarargColumnReferenceDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"`[`[`][kotlin.String.cols]`columnA, columnB`[`]`][kotlin.String.cols]` }` + * + * + * @param [firstCol] A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun String.cols(firstCol: ColumnReference, vararg otherCols: ColumnReference): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"`[`[`][kotlin.String.cols]`columnA, columnB`[`]`][kotlin.String.cols]` }` + * + * + * @param [firstCol] A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun String.get( + firstCol: ColumnReference, + vararg otherCols: ColumnReference, + ): ColumnSet = cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { Type::myColumnGroup.`[`cols`][SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][KProperty.cols]`"pathTo"["colA"], "pathTo"["colB"]`[`]`][KProperty.cols]` }` + * + * + * @param [firstCol] A [ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface KPropertyColsVarargColumnReferenceDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][kotlin.reflect.KProperty.cols]`"pathTo"["colA"], "pathTo"["colB"]`[`]`][kotlin.reflect.KProperty.cols]` }` + * + * + * @param [firstCol] A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun KProperty<*>.cols( + firstCol: ColumnReference, + vararg otherCols: ColumnReference, + ): ColumnSet = columnGroup(this).cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][kotlin.reflect.KProperty.cols]`"pathTo"["colA"], "pathTo"["colB"]`[`]`][kotlin.reflect.KProperty.cols]` }` + * + * + * @param [firstCol] A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun KProperty<*>.get( + firstCol: ColumnReference, + vararg otherCols: ColumnReference, + ): ColumnSet = cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][ColumnPath.cols]`(columnA, columnB) }` + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][ColumnPath.cols]`("pathTo"["colA"], "pathTo"["colB"]) }` + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][ColumnPath.cols]`columnA, columnB`[`]`][ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface ColumnPathColsVarargColumnReferenceDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`("pathTo"["colA"], "pathTo"["colB"]) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`columnA, columnB`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun ColumnPath.cols(firstCol: ColumnReference, vararg otherCols: ColumnReference): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`("pathTo"["colA"], "pathTo"["colB"]) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`columnA, columnB`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] that points to a relative column. + * @param [otherCols] Optional additional [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun ColumnPath.get( + firstCol: ColumnReference, + vararg otherCols: ColumnReference, + ): ColumnSet = cols(firstCol, *otherCols) + + // endregion + + // region names + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`<`[`String`][String]`>("columnA", "columnB") }` + * + * `df.`[`select`][DataFrame.select]` { this`[`[`][ColumnsSelectionDsl.cols]`"columnA", "columnB"`[`]`][ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface ColumnsSelectionDslVarargStringDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`<`[`String`][String]`>("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`"columnA", "columnB"`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun ColumnsSelectionDsl<*>.cols(firstCol: String, vararg otherCols: String): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`<`[`String`][String]`>("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`"columnA", "columnB"`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun ColumnsSelectionDsl<*>.cols(firstCol: String, vararg otherCols: String): ColumnSet = + this.asSingleColumn().cols(firstCol, *otherCols).cast() + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`<`[`String`][String]`>("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`"columnA", "columnB"`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun ColumnsSelectionDsl<*>.get(firstCol: String, vararg otherCols: String): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup.`[`cols`][SingleColumn.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup`[`[`][SingleColumn.cols]`"columnA", "columnB"`[`]`][SingleColumn.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface SingleColumnColsVarargStringDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`"columnA", "columnB"`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun SingleColumn>.cols(firstCol: String, vararg otherCols: String): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`"columnA", "columnB"`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun SingleColumn>.cols(firstCol: String, vararg otherCols: String): ColumnSet = + colsInternal(listOf(firstCol, *otherCols).map { pathOf(it) }).cast() + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`"columnA", "columnB"`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun SingleColumn>.get(firstCol: String, vararg otherCols: String): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "columnGroup".`[`cols`][String.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][DataFrame.select]` { "columnGroup"`[`[`][String.cols]`"columnA", "columnB"`[`]`][String.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface StringColsVarargStringDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup".`[`cols`][kotlin.String.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup"`[`[`][kotlin.String.cols]`"columnA", "columnB"`[`]`][kotlin.String.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun String.cols(firstCol: String, vararg otherCols: String): ColumnSet<*> = cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup".`[`cols`][kotlin.String.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup"`[`[`][kotlin.String.cols]`"columnA", "columnB"`[`]`][kotlin.String.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun String.cols(firstCol: String, vararg otherCols: String): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols).cast() + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup".`[`cols`][kotlin.String.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup"`[`[`][kotlin.String.cols]`"columnA", "columnB"`[`]`][kotlin.String.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun String.get(firstCol: String, vararg otherCols: String): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { Type::myColumnGroup.`[`cols`][KProperty.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][KProperty.cols]`"columnA", "columnB"`[`]`][KProperty.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface KPropertiesColsVarargStringDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][kotlin.reflect.KProperty.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][kotlin.reflect.KProperty.cols]`"columnA", "columnB"`[`]`][kotlin.reflect.KProperty.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun KProperty<*>.cols(firstCol: String, vararg otherCols: String): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][kotlin.reflect.KProperty.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][kotlin.reflect.KProperty.cols]`"columnA", "columnB"`[`]`][kotlin.reflect.KProperty.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun KProperty<*>.cols(firstCol: String, vararg otherCols: String): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols).cast() + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][kotlin.reflect.KProperty.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][kotlin.reflect.KProperty.cols]`"columnA", "columnB"`[`]`][kotlin.reflect.KProperty.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun KProperty<*>.get(firstCol: String, vararg otherCols: String): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][ColumnPath.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][ColumnPath.cols]`"columnA", "columnB"`[`]`][ColumnPath.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface ColumnPathColsVarargStringDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`"columnA", "columnB"`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun ColumnPath.cols(firstCol: String, vararg otherCols: String): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`"columnA", "columnB"`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun ColumnPath.cols(firstCol: String, vararg otherCols: String): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols).cast() + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`("columnA", "columnB") }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`"columnA", "columnB"`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun ColumnPath.get(firstCol: String, vararg otherCols: String): ColumnSet<*> = + cols(firstCol, *otherCols) + + // endregion + + // region paths + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][DataFrame.select]` { this`[`[`][ColumnsSelectionDsl.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface ColumnsSelectionDslVarargColumnPathDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun ColumnsSelectionDsl<*>.cols(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun ColumnsSelectionDsl<*>.cols(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet = + asSingleColumn().cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [String] that points to a relative column. + * @param [otherCols] Optional additional [String]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun ColumnsSelectionDsl<*>.get(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup.`[`cols`][SingleColumn.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup.`[`cols`][SingleColumn.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup`[`[`][SingleColumn.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][SingleColumn.cols]` }` + * + * + * @param [firstCol] A [ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface SingleColumnColsVarargColumnPathDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun SingleColumn>.cols(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun SingleColumn>.cols(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet = + colsInternal(listOf(firstCol, *otherCols)).cast() + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun SingleColumn>.get( + firstCol: ColumnPath, + vararg otherCols: ColumnPath, + ): ColumnSet<*> = cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "columnGroup".`[`cols`][String.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][DataFrame.select]` { "columnGroup".`[`cols`][String.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][DataFrame.select]` { "columnGroup"`[`[`][String.cols]`""pathTo"["colA"], "pathTo"["colB"])`[`]`][ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface StringColsVarargColumnPathDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup".`[`cols`][kotlin.String.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup".`[`cols`][kotlin.String.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup"`[`[`][kotlin.String.cols]`""pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun String.cols(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup".`[`cols`][kotlin.String.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup".`[`cols`][kotlin.String.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup"`[`[`][kotlin.String.cols]`""pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun String.cols(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols).cast() + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup".`[`cols`][kotlin.String.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup".`[`cols`][kotlin.String.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnGroup"`[`[`][kotlin.String.cols]`""pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun String.get(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { Type::myColumnGroup.`[`cols`][KProperty.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][DataFrame.select]` { Type::myColumnGroup.`[`cols`][KProperty.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][KProperty.cols]`"columnA", "columnB"`[`]`][KProperty.cols]` }` + * + * + * @param [firstCol] A [ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface KPropertiesColsVarargColumnPathDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][kotlin.reflect.KProperty.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][kotlin.reflect.KProperty.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][kotlin.reflect.KProperty.cols]`"columnA", "columnB"`[`]`][kotlin.reflect.KProperty.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun KProperty<*>.cols(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][kotlin.reflect.KProperty.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][kotlin.reflect.KProperty.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][kotlin.reflect.KProperty.cols]`"columnA", "columnB"`[`]`][kotlin.reflect.KProperty.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun KProperty<*>.cols(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols).cast() + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][kotlin.reflect.KProperty.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][kotlin.reflect.KProperty.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { DataSchemaType::myColumnGroup`[`[`][kotlin.reflect.KProperty.cols]`"columnA", "columnB"`[`]`][kotlin.reflect.KProperty.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun KProperty<*>.get(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][ColumnPath.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][ColumnPath.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][ColumnPath.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface ColumnPathColsVarargColumnPathDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun ColumnPath.cols(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet<*> = + cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun ColumnPath.cols(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols).cast() + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`<`[`String`][String]`>("pathTo"["colA"], "pathTo"["colB"])) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`"pathTo"["colA"], "pathTo"["colB"])`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] that points to a relative column. + * @param [otherCols] Optional additional [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun ColumnPath.get(firstCol: ColumnPath, vararg otherCols: ColumnPath): ColumnSet<*> = + cols(firstCol, *otherCols) + + // endregion + + // region properties + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][DataFrame.select]` { this`[`[`][ColumnsSelectionDsl.cols]`Type::colA, Type::colB`[`]`][ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface ColumnsSelectionDslColsVarargKPropertyDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`Type::colA, Type::colB`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun ColumnsSelectionDsl<*>.cols(firstCol: KProperty, vararg otherCols: KProperty): ColumnSet = + this.asSingleColumn().cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { this`[`[`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`Type::colA, Type::colB`[`]`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun ColumnsSelectionDsl<*>.get( + firstCol: KProperty, + vararg otherCols: KProperty, + ): ColumnSet = cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup.`[`cols`][SingleColumn.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup`[`[`][SingleColumn.cols]`Type::colA, Type::colB`[`]`][SingleColumn.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface SingleColumnColsVarargKPropertyDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`Type::colA, Type::colB`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun SingleColumn>.cols( + firstCol: KProperty, + vararg otherCols: KProperty, + ): ColumnSet = colsInternal(listOf(firstCol, *otherCols).map { pathOf(it.name) }).cast() + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`Type::colA, Type::colB`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun SingleColumn>.get( + firstCol: KProperty, + vararg otherCols: KProperty, + ): ColumnSet = cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "myColumnGroup".`[`cols`][String.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][DataFrame.select]` { "myColumnGroup"`[`[`][String.cols]`Type::colA, Type::colB`[`]`][String.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface StringColsVarargKPropertyDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"`[`[`][kotlin.String.cols]`Type::colA, Type::colB`[`]`][kotlin.String.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun String.cols(firstCol: KProperty, vararg otherCols: KProperty): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"`[`[`][kotlin.String.cols]`Type::colA, Type::colB`[`]`][kotlin.String.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun String.get(firstCol: KProperty, vararg otherCols: KProperty): ColumnSet = + cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { Type::myColumnGroup.`[`cols`][SingleColumn.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][DataFrame.select]` { Type::myColumnGroup`[`[`][SingleColumn.cols]`Type::colA, Type::colB`[`]`][SingleColumn.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface KPropertyColsVarargKPropertyDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`Type::colA, Type::colB`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun KProperty<*>.cols(firstCol: KProperty, vararg otherCols: KProperty): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`Type::colA, Type::colB`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun KProperty<*>.get(firstCol: KProperty, vararg otherCols: KProperty): ColumnSet = + cols(firstCol, *otherCols) + + /** + * ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][ColumnPath.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][ColumnPath.cols]`Type::colA, Type::colB`[`]`][ColumnPath.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + private interface ColumnPathColsVarargKPropertyDocs + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`Type::colA, Type::colB`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public fun ColumnPath.cols(firstCol: KProperty, vararg otherCols: KProperty): ColumnSet = + columnGroup(this).cols(firstCol, *otherCols) + + /** ## Cols + * Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this]. + * + * You can use either a [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter], or any of the `vararg` overloads for any + * [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. The function can be both typed and untyped (in case you're supplying + * a column name, -path, or index (range)). + * + * This function operates solely on columns at the top-level. + * + * Aside from calling [cols][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.cols] directly, you can also use the [`get`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.get] operator in most cases. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * `df.`[`remove`][org.jetbrains.kotlinx.dataframe.DataFrame.remove]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[`hasNulls`][org.jetbrains.kotlinx.dataframe.DataColumn.hasNulls]`() } }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myGroupCol.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(columnA, columnB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`String`][String]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1, 3, 5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`(Type::colA, Type::colB) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["columnGroup"]`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`Type::colA, Type::colB`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]` }` + * + * + * @param [firstCol] A [KProperty] that points to a relative column. + * @param [otherCols] Optional additional [KProperty]s that point to relative columns. + * @throws [IllegalArgumentException] if any of the given [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference]s point to a column that doesn't + * exist. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns that [firstCol] and [otherCols] point to. + */ + public operator fun ColumnPath.get(firstCol: KProperty, vararg otherCols: KProperty): ColumnSet = + cols(firstCol, *otherCols) + + // endregion + + // region indices + + /** + * ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { `[`colsOf`][SingleColumn.colsOf]`<`[`Int`][Int]`>().`[`cols`][ColumnSet.cols]`(1, 3) }` + * + * `df.`[`select`][DataFrame.select]` { `[`all`][ColumnsSelectionDsl.all]`()`[`[`][ColumnSet.cols]`5, 1`[`]`][ColumnSet.cols]` }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface ColumnSetColsIndicesDocs + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`Int`][Int]`>().`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`(1, 3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`all`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`5, 1`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet = + colsInternal(headPlusArray(firstIndex, otherIndices)) as ColumnSet + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`Int`][Int]`>().`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`(1, 3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`all`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`5, 1`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public operator fun ColumnSet.get(firstIndex: Int, vararg otherIndices: Int): ColumnSet = + cols(firstIndex, *otherIndices) + + /** + * ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`(1, 3) }` + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`<`[`String`][String]`>(1, 3) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface ColumnsSelectionDslColsIndicesDocs + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1, 3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`<`[`String`][String]`>(1, 3) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun ColumnsSelectionDsl<*>.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet<*> = + cols(firstIndex, *otherIndices) + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1, 3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`<`[`String`][String]`>(1, 3) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public fun ColumnsSelectionDsl<*>.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet = + this.asSingleColumn().colsInternal(headPlusArray(firstIndex, otherIndices)).cast() + + /** + * ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup.`[`cols`][SingleColumn.cols]`(1, 3) }` + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup.`[`cols`][SingleColumn.cols]`<`[`String`][String]`>(3, 4) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface SingleColumnColsIndicesDocs + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>(3, 4) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun SingleColumn>.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet<*> = + cols(firstIndex, *otherIndices) + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>(3, 4) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public fun SingleColumn>.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet = + this.ensureIsColumnGroup().colsInternal(headPlusArray(firstIndex, otherIndices)).cast() + + /** + * ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "myColumnGroup".`[`cols`][String.cols]`(5, 3, 1) }` + * + * `df.`[`select`][DataFrame.select]` { "myColumnGroup".`[`cols`][String.cols]`<`[`String`][String]`>(5, 3, 1) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface StringColsIndicesDocs + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(5, 3, 1) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`<`[`String`][String]`>(5, 3, 1) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun String.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet<*> = + cols(firstIndex, *otherIndices) + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(5, 3, 1) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`<`[`String`][String]`>(5, 3, 1) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public fun String.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet = + columnGroup(this).cols(firstIndex, *otherIndices).cast() + + /** + * ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { Type::myColumnGroup.`[`cols`][SingleColumn.cols]`(5, 4) }` + * + * `df.`[`select`][DataFrame.select]` { Type::myColumnGroup.`[`cols`][SingleColumn.cols]`<`[`String`][String]`>(5, 4) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface KPropertyColsIndicesDocs + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(5, 4) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>(5, 4) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun KProperty<*>.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet<*> = + cols(firstIndex, *otherIndices) + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(5, 4) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>(5, 4) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public fun KProperty<*>.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet = + columnGroup(this).cols(firstIndex, *otherIndices).cast() + + /** + * ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][ColumnPath.cols]`(0, 1) }` + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][ColumnPath.cols]`<`[`String`][String]`>(0, 1) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface ColumnPathColsIndicesDocs + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`(0, 1) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`<`[`String`][String]`>(0, 1) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun ColumnPath.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet<*> = + cols(firstIndex, *otherIndices) + + /** ## Cols: Columns by Indices + * + * Retrieves one or multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by their indices. + * If any of the indices are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1, 3, 2) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]`5, 1, 2`[`]`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.get]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`cols`][kotlin.String.cols]`(0, 2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`(0, 1) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`<`[`String`][String]`>(0, 1) }` + * + * @throws [IndexOutOfBoundsException] If any index is out of bounds. + * @param [firstIndex] The index of the first column to retrieve. + * @param [otherIndices] The other indices of the columns to retrieve. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public fun ColumnPath.cols(firstIndex: Int, vararg otherIndices: Int): ColumnSet = + columnGroup(this).cols(firstIndex, *otherIndices).cast() + + // endregion + + // region ranges + + /** + * ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { `[`colsOf`][SingleColumn.colsOf]`<`[`Int`][Int]`>().`[`cols`][ColumnSet.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][DataFrame.select]` { `[`all`][all]`()`[`[`][ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][ColumnSet.cols]` }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface ColumnSetColsRangeDocs + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`Int`][Int]`>().`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`all`][org.jetbrains.kotlinx.dataframe.api.all]`()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.cols(range: IntRange): ColumnSet = colsInternal(range) as ColumnSet + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[`Int`][Int]`>().`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`all`][org.jetbrains.kotlinx.dataframe.api.all]`()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public operator fun ColumnSet.get(range: IntRange): ColumnSet = cols(range) + + /** + * ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][DataFrame.select]` { `[`cols`][ColumnsSelectionDsl.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface ColumnsSelectionDslColsRangeDocs + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun ColumnsSelectionDsl<*>.cols(range: IntRange): ColumnSet<*> = cols(range) + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public fun ColumnsSelectionDsl<*>.cols(range: IntRange): ColumnSet = + this.asSingleColumn().colsInternal(range).cast() + + /** + * ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup.`[`cols`][SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][DataFrame.select]` { myColumnGroup.`[`cols`][SingleColumn.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface SingleColumnColsRangeDocs + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun SingleColumn>.cols(range: IntRange): ColumnSet<*> = cols(range) + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public fun SingleColumn>.cols(range: IntRange): ColumnSet = + this.ensureIsColumnGroup().colsInternal(range).cast() + + /** + * ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "myColGroup".`[`cols`][String.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][DataFrame.select]` { "myColGroup".`[`cols`][String.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface StringColsRangeDocs + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun String.cols(range: IntRange): ColumnSet<*> = cols(range) + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public fun String.cols(range: IntRange): ColumnSet = columnGroup(this).cols(range).cast() + + /** + * ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { Type::myColumnGroup.`[`cols`][SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][DataFrame.select]` { Type::myColumnGroup.`[`cols`][SingleColumn.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface KPropertyColsRangeDocs + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun KProperty<*>.cols(range: IntRange): ColumnSet<*> = cols(range) + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`<`[`String`][String]`>(1`[`..`][Int.rangeTo]`3) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public fun KProperty<*>.cols(range: IntRange): ColumnSet = columnGroup(this).cols(range).cast() + + /** + * ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][ColumnPath.cols]`(0`[`..`][Int.rangeTo]`1) }` + * + * `df.`[`select`][DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][ColumnPath.cols]`<`[`String`][String]`>(0`[`..`][Int.rangeTo]`1) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + private interface ColumnPathColsRangeDocs + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`(0`[`..`][Int.rangeTo]`1) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`<`[`String`][String]`>(0`[`..`][Int.rangeTo]`1) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("colsUnTyped") + public fun ColumnPath.cols(range: IntRange): ColumnSet<*> = cols(range) + + /** ## Cols: Columns by Index Range + * + * Retrieves multiple columns from [this] in the form of a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] by a [range] of indices. + * If any of the indices in the [range] are out of bounds, an [IndexOutOfBoundsException] is thrown. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.cols]`(1`[`..`][Int.rangeTo]`3) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`colsOf`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[`Int`][Int]`>()`[`[`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]`1`[`..`][Int.rangeTo]`5`[`]`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.cols]` }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[`cols`][kotlin.String.cols]`(0`[`..`][Int.rangeTo]`2) }` + * + * #### Examples for this overload: + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`(0`[`..`][Int.rangeTo]`1) }` + * + * `df.`[`select`][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColGroup"].`[`cols`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.cols]`<`[`String`][String]`>(0`[`..`][Int.rangeTo]`1) }` + * + * @throws [IndexOutOfBoundsException] if any of the indices in the [range] are out of bounds. + * @throws [IllegalArgumentException] if the [range] is empty. + * @param [range] The range of indices to retrieve in the form of an [IntRange]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns found at the given indices. + */ + public fun ColumnPath.cols(range: IntRange): ColumnSet = columnGroup(this).cols(range).cast() + + // endregion +} + +internal fun SingleColumn>.colsInternal(refs: Iterable>): ColumnSet<*> = + ensureIsColumnGroup().transformSingle { col -> + refs.map { + col.getCol(it) ?: throw IllegalArgumentException( + "Column at ${col.path.plus(it.path()).joinToString()} was not found.", + ) + } + } + +/** + * If this [ColumnsResolver] is a [SingleColumn], it + * returns a new [ColumnSet] containing the columns inside of this [SingleColumn] that + * match the given [predicate]. + * + * Else, it returns a new [ColumnSet] containing all columns in this [ColumnsResolver] that + * match the given [predicate]. + */ +internal fun ColumnsResolver<*>.colsInternal(predicate: ColumnFilter<*>): TransformableColumnSet<*> = + allColumnsInternal().transform { it.filter(predicate) } + +internal fun ColumnsResolver<*>.colsInternal(indices: IntArray): TransformableColumnSet<*> = + allColumnsInternal().transform { cols -> + indices.map { + try { + cols[it] + } catch (e: IndexOutOfBoundsException) { + throw IndexOutOfBoundsException("Index $it is out of bounds for column set of size ${cols.size}") + } + } + } + +internal fun ColumnsResolver<*>.colsInternal(range: IntRange): TransformableColumnSet<*> = + allColumnsInternal().transform { + try { + it.subList(range.first, range.last + 1) + } catch (e: IndexOutOfBoundsException) { + throw IndexOutOfBoundsException("Range $range is out of bounds for column set of size ${it.size}") + } + } diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsAtAnyDepth.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsAtAnyDepth.kt new file mode 100644 index 000000000..f4994c31c --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsAtAnyDepth.kt @@ -0,0 +1,511 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.atAnyDepthImpl +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Cols At Any Depth [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface ColsAtAnyDepthColumnsSelectionDsl { + + // region atAnyDepth + + /** + * ## Cols At Any Depth Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`colsAtAnyDepth`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`colsAtAnyDepth`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`colsAtAnyDepth`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`colsAtAnyDepth`**][ColumnsSelectionDsl.colsAtAnyDepth] */ + public interface PlainDslName + + /** __`.`__[**`colsAtAnyDepth`**][ColumnsSelectionDsl.colsAtAnyDepth] */ + public interface ColumnSetName + + /** __`.`__[**`colsAtAnyDepth`**][ColumnsSelectionDsl.colsAtAnyDepth] */ + public interface ColumnGroupName + } + + /** + * ## Cols At Any Depth + * + * Returns all columns in [this] at any depth (so also inside [Column Groups][ColumnGroup]) if they satisfy the + * optional given predicate. + * + * This function can also be followed by another [ColumnSet] filter function like + * [colsOf][ColumnsSelectionDsl.colsOf], [single][ColumnsSelectionDsl.single], or [valueCols][ColumnsSelectionDsl.valueCols]. + * ### Check out: [Grammar] + * #### For example: + * `// Depth-first search to a column containing the value "Alice"` + * + * `df.`[select][DataFrame.select]` { `[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]`().`[first][ColumnsSelectionDsl.firstCol]` { "Alice" `[in][Iterable.contains]` it.`[values][DataColumn.values]`() } }` + * + *      + * + * `// The columns at any depth excluding the top-level` + * + * `df.`[select][DataFrame.select]` { `[colGroups][ColumnsSelectionDsl.colGroups]`().`[colsAtAnyDepth][ColumnSet.colsAtAnyDepth]`() }` + * + *      + * + * `// All value- and frame columns at any depth` + * + * `df.`[select][DataFrame.select]` { `[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]` { !it.`[isColumnGroup][DataColumn.isColumnGroup]` } }` + * + *      + * + * `// All value columns at any depth nested under a column group named "myColGroup"` + * + * `df.`[select][DataFrame.select]` { myColGroup.`[colsAtAnyDepth][SingleColumn.colsAtAnyDepth]`().`[valueCols][ColumnsSelectionDsl.valueCols]`() }` + * + * #### Examples for this overload: + * + * + * + * #### Converting from deprecated syntax: + * + * `dfs { condition } -> `[colsAtAnyDepth][colsAtAnyDepth]` { condition }` + * + * `allDfs(includeGroups = false) -> `[colsAtAnyDepth][colsAtAnyDepth]` { includeGroups || !it.`[isColumnGroup][DataColumn.isColumnGroup]`() }` + * + * `dfsOf { condition } -> `[colsAtAnyDepth][colsAtAnyDepth]`().`[colsOf][ColumnsSelectionDsl.colsOf]` { condition }` + * + * [cols][ColumnsSelectionDsl.cols]` { condition }.`[recursively][recursively]`() -> `[colsAtAnyDepth][colsAtAnyDepth]` { condition }` + * + * [first][ColumnsSelectionDsl.first]` { condition }.`[rec][rec]`() -> `[colsAtAnyDepth][colsAtAnyDepth]` { condition }.`[first][ColumnsSelectionDsl.first]`()` + * + * [all][ColumnsSelectionDsl.all]`().`[recursively][recursively]`() -> `[colsAtAnyDepth][colsAtAnyDepth]`()` + * + * @see [DataFrame.flatten] + * @see [ColumnsSelectionDsl.simplify] + */ + private interface CommonAtAnyDepthDocs { + + /** Example argument */ + interface Examples + } + + /** + * ## Cols At Any Depth + * + * Returns all columns in [this] at any depth (so also inside [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]) if they satisfy the + * optional given predicate. + * + * This function can also be followed by another [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] filter function like + * [colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf], [single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single], or [valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]. + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.Grammar] + * #### For example: + * `// Depth-first search to a column containing the value "Alice"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[first][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.firstCol]` { "Alice" `[in][Iterable.contains]` it.`[values][org.jetbrains.kotlinx.dataframe.DataColumn.values]`() } }` + * + *      + * + * `// The columns at any depth excluding the top-level` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`().`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsAtAnyDepth]`() }` + * + *      + * + * `// All value- and frame columns at any depth` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]` } }` + * + *      + * + * `// All value columns at any depth nested under a column group named "myColGroup"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colGroups][ColumnsSelectionDsl.colGroups]`().`[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]` { "Alice" `[in][Iterable.contains]` it.`[values][DataColumn.values]`() } }` + * + * #### Converting from deprecated syntax: + * + * `dfs { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * `allDfs(includeGroups = false) -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { includeGroups || !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]`() }` + * + * `dfsOf { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`().`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]` { condition }` + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { condition }.`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * [first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { condition }.`[rec][rec]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }.`[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]`()` + * + * [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`()` + * + * @see [DataFrame.flatten] + * @see [ColumnsSelectionDsl.simplify] + */ + public fun ColumnSet<*>.colsAtAnyDepth(predicate: ColumnFilter<*> = { true }): ColumnSet<*> = + colsAtAnyDepthInternal(predicate) + + /** + * ## Cols At Any Depth + * + * Returns all columns in [this] at any depth (so also inside [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]) if they satisfy the + * optional given predicate. + * + * This function can also be followed by another [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] filter function like + * [colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf], [single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single], or [valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]. + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.Grammar] + * #### For example: + * `// Depth-first search to a column containing the value "Alice"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[first][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.firstCol]` { "Alice" `[in][Iterable.contains]` it.`[values][org.jetbrains.kotlinx.dataframe.DataColumn.values]`() } }` + * + *      + * + * `// The columns at any depth excluding the top-level` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`().`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsAtAnyDepth]`() }` + * + *      + * + * `// All value- and frame columns at any depth` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]` } }` + * + *      + * + * `// All value columns at any depth nested under a column group named "myColGroup"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]` { "Alice" `[in][Iterable.contains]` it.`[values][DataColumn.values]`() }.`[first][ColumnsSelectionDsl.first]`() }` + * + * `df.`[select][DataFrame.select]` { `[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]` { !it.`[isColumnGroup][DataColumn.isColumnGroup]` } }` + * + * #### Converting from deprecated syntax: + * + * `dfs { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * `allDfs(includeGroups = false) -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { includeGroups || !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]`() }` + * + * `dfsOf { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`().`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]` { condition }` + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { condition }.`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * [first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { condition }.`[rec][rec]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }.`[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]`()` + * + * [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`()` + * + * @see [DataFrame.flatten] + * @see [ColumnsSelectionDsl.simplify] + */ + @Interpretable("ColsAtAnyDepth0") + public fun ColumnsSelectionDsl<*>.colsAtAnyDepth(predicate: ColumnFilter<*> = { true }): ColumnSet<*> = + asSingleColumn().colsAtAnyDepthInternal(predicate) + + /** + * ## Cols At Any Depth + * + * Returns all columns in [this] at any depth (so also inside [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]) if they satisfy the + * optional given predicate. + * + * This function can also be followed by another [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] filter function like + * [colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf], [single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single], or [valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]. + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.Grammar] + * #### For example: + * `// Depth-first search to a column containing the value "Alice"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[first][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.firstCol]` { "Alice" `[in][Iterable.contains]` it.`[values][org.jetbrains.kotlinx.dataframe.DataColumn.values]`() } }` + * + *      + * + * `// The columns at any depth excluding the top-level` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`().`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsAtAnyDepth]`() }` + * + *      + * + * `// All value- and frame columns at any depth` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]` } }` + * + *      + * + * `// All value columns at any depth nested under a column group named "myColGroup"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColGroup.`[colsAtAnyDepth][SingleColumn.colsAtAnyDepth]` { "Alice" `[in][Iterable.contains]` it.`[values][DataColumn.values]`() } }` + * + * #### Converting from deprecated syntax: + * + * `dfs { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * `allDfs(includeGroups = false) -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { includeGroups || !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]`() }` + * + * `dfsOf { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`().`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]` { condition }` + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { condition }.`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * [first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { condition }.`[rec][rec]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }.`[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]`()` + * + * [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`()` + * + * @see [DataFrame.flatten] + * @see [ColumnsSelectionDsl.simplify] + */ + public fun SingleColumn>.colsAtAnyDepth(predicate: ColumnFilter<*> = { true }): ColumnSet<*> = + ensureIsColumnGroup().colsAtAnyDepthInternal(predicate) + + /** + * ## Cols At Any Depth + * + * Returns all columns in [this] at any depth (so also inside [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]) if they satisfy the + * optional given predicate. + * + * This function can also be followed by another [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] filter function like + * [colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf], [single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single], or [valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]. + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.Grammar] + * #### For example: + * `// Depth-first search to a column containing the value "Alice"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[first][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.firstCol]` { "Alice" `[in][Iterable.contains]` it.`[values][org.jetbrains.kotlinx.dataframe.DataColumn.values]`() } }` + * + *      + * + * `// The columns at any depth excluding the top-level` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`().`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsAtAnyDepth]`() }` + * + *      + * + * `// All value- and frame columns at any depth` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]` } }` + * + *      + * + * `// All value columns at any depth nested under a column group named "myColGroup"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[colsAtAnyDepth][String.colsAtAnyDepth]` { "Alice" `[in][Iterable.contains]` it.`[values][DataColumn.values]`() } }` + * + * #### Converting from deprecated syntax: + * + * `dfs { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * `allDfs(includeGroups = false) -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { includeGroups || !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]`() }` + * + * `dfsOf { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`().`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]` { condition }` + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { condition }.`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * [first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { condition }.`[rec][rec]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }.`[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]`()` + * + * [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`()` + * + * @see [DataFrame.flatten] + * @see [ColumnsSelectionDsl.simplify] + */ + public fun String.colsAtAnyDepth(predicate: ColumnFilter<*> = { true }): ColumnSet<*> = + columnGroup(this).colsAtAnyDepth(predicate) + + /** + * ## Cols At Any Depth + * + * Returns all columns in [this] at any depth (so also inside [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]) if they satisfy the + * optional given predicate. + * + * This function can also be followed by another [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] filter function like + * [colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf], [single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single], or [valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]. + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.Grammar] + * #### For example: + * `// Depth-first search to a column containing the value "Alice"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[first][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.firstCol]` { "Alice" `[in][Iterable.contains]` it.`[values][org.jetbrains.kotlinx.dataframe.DataColumn.values]`() } }` + * + *      + * + * `// The columns at any depth excluding the top-level` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`().`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsAtAnyDepth]`() }` + * + *      + * + * `// All value- and frame columns at any depth` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]` } }` + * + *      + * + * `// All value columns at any depth nested under a column group named "myColGroup"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[colsAtAnyDepth][KProperty.colsAtAnyDepth]` { "Alice" `[in][Iterable.contains]` it.`[values][DataColumn.values]`() } }` + * + * #### Converting from deprecated syntax: + * + * `dfs { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * `allDfs(includeGroups = false) -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { includeGroups || !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]`() }` + * + * `dfsOf { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`().`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]` { condition }` + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { condition }.`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * [first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { condition }.`[rec][rec]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }.`[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]`()` + * + * [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`()` + * + * @see [DataFrame.flatten] + * @see [ColumnsSelectionDsl.simplify] + */ + public fun KProperty<*>.colsAtAnyDepth(predicate: ColumnFilter<*> = { true }): ColumnSet<*> = + columnGroup(this).colsAtAnyDepth(predicate) + + /** + * ## Cols At Any Depth + * + * Returns all columns in [this] at any depth (so also inside [Column Groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]) if they satisfy the + * optional given predicate. + * + * This function can also be followed by another [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] filter function like + * [colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf], [single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single], or [valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]. + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.Grammar] + * #### For example: + * `// Depth-first search to a column containing the value "Alice"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[first][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.firstCol]` { "Alice" `[in][Iterable.contains]` it.`[values][org.jetbrains.kotlinx.dataframe.DataColumn.values]`() } }` + * + *      + * + * `// The columns at any depth excluding the top-level` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]`().`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsAtAnyDepth]`() }` + * + *      + * + * `// All value- and frame columns at any depth` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]` { !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]` } }` + * + *      + * + * `// All value columns at any depth nested under a column group named "myColGroup"` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myGroupCol"].`[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]` { "Alice" `[in][Iterable.contains]` it.`[values][DataColumn.values]`() } }` + * + * #### Converting from deprecated syntax: + * + * `dfs { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * `allDfs(includeGroups = false) -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { includeGroups || !it.`[isColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.isColumnGroup]`() }` + * + * `dfsOf { condition } -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`().`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]` { condition }` + * + * [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { condition }.`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }` + * + * [first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { condition }.`[rec][rec]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]` { condition }.`[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]`()` + * + * [all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[recursively][recursively]`() -> `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColsAtAnyDepthColumnsSelectionDsl.colsAtAnyDepth]`()` + * + * @see [DataFrame.flatten] + * @see [ColumnsSelectionDsl.simplify] + */ + public fun ColumnPath.colsAtAnyDepth(predicate: ColumnFilter<*> = { true }): ColumnSet<*> = + columnGroup(this).colsAtAnyDepth(predicate) + + // endregion +} + +/** + * Returns all columns inside this [ColumnsResolver] at any depth if they satisfy the + * given predicate. + */ +internal fun ColumnsResolver<*>.colsAtAnyDepthInternal(predicate: ColumnFilter<*>): ColumnSet<*> = + colsInternal(predicate) + .atAnyDepthImpl(includeTopLevel = true, includeGroups = true) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsInGroups.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsInGroups.kt new file mode 100644 index 000000000..967f7ccd2 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsInGroups.kt @@ -0,0 +1,463 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.transform +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Cols in Groups [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface ColsInGroupsColumnsSelectionDsl { + + /** + * ## Cols in Groups Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`colsInGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`colsInGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`colsInGroups`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`colsInGroups`**][ColumnsSelectionDsl.colsInGroups] */ + public interface PlainDslName + + /** __`.`__[**`colsInGroups`**][ColumnsSelectionDsl.colsInGroups] */ + public interface ColumnSetName + + /** __`.`__[**`colsInGroups`**][ColumnsSelectionDsl.colsInGroups] */ + public interface ColumnGroupName + } + + /** + * ## Cols in Groups + * + * [colsInGroups][colsInGroups] is a function that returns all (optionally filtered) columns at the top-levels of + * all [column groups][ColumnGroup] in [this]. This is useful if you want to select all columns that are + * "one level deeper". + * + * NOTE: This function should not be confused with [cols][ColumnsSelectionDsl.cols], which operates on all + * columns directly in [this], or with [colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth], which operates on all + * columns in [this] at any depth. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * To get only the columns inside all column groups in a [DataFrame], instead of having to write: + * + * `df.`[select][DataFrame.select]` { colGroupA.`[cols][ColumnsSelectionDsl.cols]`() `[and][ColumnsSelectionDsl.and]` colGroupB.`[cols][ColumnsSelectionDsl.cols]`() ... }` + * + * you can use: + * + * `df.`[select][DataFrame.select]` { `[colsInGroups][ColumnsSelectionDsl.colsInGroups]`() }` + * + * and + * + * `df.`[select][DataFrame.select]` { `[colsInGroups][ColumnsSelectionDsl.colsInGroups]` { "user" `[in][String.contains]` it.`[name][DataColumn.name]` } }` + * + *      + * + * Similarly, you can take the columns inside all [column groups][ColumnGroup] in a [ColumnSet]: + * + *      + * + * `df.`[select][DataFrame.select]` { `[colGroups][ColumnsSelectionDsl.colGroups]` { "my" `[in][String.contains]` it.`[name][DataColumn.name]` }.`[colsInGroups][ColumnSet.colsInGroups]`() }` + * + *      + * + * + * #### Examples of this overload: + * + * + * + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.colGroups] + * @param [predicate] An optional predicate to filter the cols by. + * @return A [TransformableColumnSet] containing the (filtered) cols. + */ + private interface ColsInGroupsDocs { + + /** Example argument to use */ + interface ExampleArg + } + + /** + * ## Cols in Groups + * + * [colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.colsInGroups] is a function that returns all (optionally filtered) columns at the top-levels of + * all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in [this]. This is useful if you want to select all columns that are + * "one level deeper". + * + * NOTE: This function should not be confused with [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], which operates on all + * columns directly in [this], or with [colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth], which operates on all + * columns in [this] at any depth. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * To get only the columns inside all column groups in a [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame], instead of having to write: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroupA.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colGroupB.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() ... }` + * + * you can use: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]`() }` + * + * and + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` { "user" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + *      + * + * Similarly, you can take the columns inside all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + *      + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[colsInGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsInGroups]`() }` + * + *      + * + * + * #### Examples of this overload: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[colsInGroups][ColumnSet.colsInGroups]` { "my" `[in][String.contains]` it.`[name][DataColumn.name]` } }` + * + * `df.`[select][DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[DataRow][DataRow]`>().`[colsInGroups][ColumnSet.colsInGroups]`() }` + * + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.colGroups] + * @param [predicate] An optional predicate to filter the cols by. + * @return A [TransformableColumnSet][org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet] containing the (filtered) cols. + */ + public fun ColumnSet<*>.colsInGroups(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + transform { it.flatMap { it.cols().filter { predicate(it) } } } + + /** + * ## Cols in Groups + * + * [colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.colsInGroups] is a function that returns all (optionally filtered) columns at the top-levels of + * all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in [this]. This is useful if you want to select all columns that are + * "one level deeper". + * + * NOTE: This function should not be confused with [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], which operates on all + * columns directly in [this], or with [colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth], which operates on all + * columns in [this] at any depth. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * To get only the columns inside all column groups in a [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame], instead of having to write: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroupA.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colGroupB.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() ... }` + * + * you can use: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]`() }` + * + * and + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` { "user" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + *      + * + * Similarly, you can take the columns inside all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + *      + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[colsInGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsInGroups]`() }` + * + *      + * + * + * #### Examples of this overload: + * + * `df.`[select][DataFrame.select]` { `[colsInGroups][ColumnSet.colsInGroups]` { "my" `[in][String.contains]` it.`[name][DataColumn.name]` } }` + * + * `df.`[select][DataFrame.select]` { `[colsInGroups][ColumnSet.colsInGroups]`() }` + * + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.colGroups] + * @param [predicate] An optional predicate to filter the cols by. + * @return A [TransformableColumnSet][org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet] containing the (filtered) cols. + */ + public fun ColumnsSelectionDsl<*>.colsInGroups(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + asSingleColumn().colsInGroups(predicate) + + /** + * ## Cols in Groups + * + * [colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.colsInGroups] is a function that returns all (optionally filtered) columns at the top-levels of + * all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in [this]. This is useful if you want to select all columns that are + * "one level deeper". + * + * NOTE: This function should not be confused with [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], which operates on all + * columns directly in [this], or with [colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth], which operates on all + * columns in [this] at any depth. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * To get only the columns inside all column groups in a [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame], instead of having to write: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroupA.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colGroupB.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() ... }` + * + * you can use: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]`() }` + * + * and + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` { "user" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + *      + * + * Similarly, you can take the columns inside all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + *      + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[colsInGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsInGroups]`() }` + * + *      + * + * + * #### Examples of this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[colsInGroups][SingleColumn.colsInGroups]`() }` + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[colsInGroups][SingleColumn.colsInGroups]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.colGroups] + * @param [predicate] An optional predicate to filter the cols by. + * @return A [TransformableColumnSet][org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet] containing the (filtered) cols. + */ + public fun SingleColumn>.colsInGroups(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + ensureIsColumnGroup().allColumnsInternal().colsInGroups(predicate) + + /** + * ## Cols in Groups + * + * [colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.colsInGroups] is a function that returns all (optionally filtered) columns at the top-levels of + * all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in [this]. This is useful if you want to select all columns that are + * "one level deeper". + * + * NOTE: This function should not be confused with [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], which operates on all + * columns directly in [this], or with [colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth], which operates on all + * columns in [this] at any depth. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * To get only the columns inside all column groups in a [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame], instead of having to write: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroupA.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colGroupB.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() ... }` + * + * you can use: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]`() }` + * + * and + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` { "user" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + *      + * + * Similarly, you can take the columns inside all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + *      + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[colsInGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsInGroups]`() }` + * + *      + * + * + * #### Examples of this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[colsInGroups][String.colsInGroups]`() }` + * + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.colGroups] + * @param [predicate] An optional predicate to filter the cols by. + * @return A [TransformableColumnSet][org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet] containing the (filtered) cols. + */ + public fun String.colsInGroups(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + columnGroup(this).colsInGroups(predicate) + + /** + * ## Cols in Groups + * + * [colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.colsInGroups] is a function that returns all (optionally filtered) columns at the top-levels of + * all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in [this]. This is useful if you want to select all columns that are + * "one level deeper". + * + * NOTE: This function should not be confused with [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], which operates on all + * columns directly in [this], or with [colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth], which operates on all + * columns in [this] at any depth. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * To get only the columns inside all column groups in a [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame], instead of having to write: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroupA.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colGroupB.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() ... }` + * + * you can use: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]`() }` + * + * and + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` { "user" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + *      + * + * Similarly, you can take the columns inside all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + *      + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[colsInGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsInGroups]`() }` + * + *      + * + * + * #### Examples of this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[colsInGroups][KProperty.colsInGroups]`() }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[colsInGroups][KProperty.colsInGroups]`() }` + * + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.colGroups] + * @param [predicate] An optional predicate to filter the cols by. + * @return A [TransformableColumnSet][org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet] containing the (filtered) cols. + */ + public fun KProperty<*>.colsInGroups(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + columnGroup(this).colsInGroups(predicate) + + /** + * ## Cols in Groups + * + * [colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.colsInGroups] is a function that returns all (optionally filtered) columns at the top-levels of + * all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in [this]. This is useful if you want to select all columns that are + * "one level deeper". + * + * NOTE: This function should not be confused with [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols], which operates on all + * columns directly in [this], or with [colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth], which operates on all + * columns in [this] at any depth. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsInGroupsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * To get only the columns inside all column groups in a [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame], instead of having to write: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { colGroupA.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` colGroupB.`[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`() ... }` + * + * you can use: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]`() }` + * + * and + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsInGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsInGroups]` { "user" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + *      + * + * Similarly, you can take the columns inside all [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] in a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + *      + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colGroups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[colsInGroups][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.colsInGroups]`() }` + * + *      + * + * + * #### Examples of this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[colsInGroups][ColumnPath.colsInGroups]`() }` + * + * @see [ColumnsSelectionDsl.cols] + * @see [ColumnsSelectionDsl.colGroups] + * @param [predicate] An optional predicate to filter the cols by. + * @return A [TransformableColumnSet][org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet] containing the (filtered) cols. + */ + public fun ColumnPath.colsInGroups(predicate: ColumnFilter<*> = { true }): TransformableColumnSet<*> = + columnGroup(this).colsInGroups(predicate) +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsOf.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsOf.kt new file mode 100644 index 000000000..ae8ccbe68 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsOf.kt @@ -0,0 +1,641 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.size +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import kotlin.reflect.KProperty +import kotlin.reflect.KType +import kotlin.reflect.typeOf + +// region ColumnsSelectionDsl + +/** + * ## Cols Of [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface ColsOfColumnsSelectionDsl { + + /** + * ## Cols Of Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `singleColumn: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>>` + * + *      + * + * `columnGroupReference: `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * `T: Column type` + * + *      + * + * `kType: `[`KType`][kotlin.reflect.KType] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**colsOf**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**` [ `**`(`**[`kType`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.KTypeDef]**`)`**` ] [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`colsOf`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**` [ `**`(`**[`kType`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.KTypeDef]**`)`**` ] [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### On a column group reference: + * + * + *      + * + * + * [`singleColumn`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.SingleColumnDef] + * + *     __`.`__[**`colsOf`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**` [ `**`(`**[`kType`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.KTypeDef]**`)`**` ] [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + *      + * + * + * [`columnGroupReference`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupNoSingleColumnDef] + * + *     __`.`__[**`colsOf`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>(`**[`kType`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.KTypeDef]**`)`**` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**colsOf**][ColumnsSelectionDsl.colsOf] */ + public interface PlainDslName + + /** __`.`__[**`colsOf`**][ColumnsSelectionDsl.colsOf] */ + public interface ColumnSetName + + /** __`.`__[**`colsOf`**][ColumnsSelectionDsl.colsOf] */ + public interface ColumnGroupName + } + + /** + * ## Cols Of + * + * Returns a [ColumnSet] of columns from [this] that are a subtype of the given type [C], optionally filtered + * by [filter]. + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`> { it.`[size][DataColumn.size]` > 10 } }` + * + *      + * + * Alternatively, [colsOf] can also be called on existing columns: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][DataFrame.select]` { "myColumnGroup"().`[colsOf][SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][DataColumn.size]` > 10 } }` + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[colsOf][ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + *      + * + * Finally, [colsOf] can also take a [KType] argument instead of a reified type. + * This is useful when the type is not known at compile time or when the API function cannot be inlined. + * + * + * `df.`[select][DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][DataColumn]`<`[Int][Int]`> -> it.`[size][DataColumn.size]` > 10 } }` + * + * #### Examples for this overload: + */ + private interface CommonColsOfDocs { + + /** @return A [ColumnSet] containing the columns of given type that were included by [filter]. */ + interface Return + + /** @param [filter] an optional filter function that takes a column of type [C] and returns `true` if the column should be included. */ + interface FilterParam + } + + /** + * ## Cols Of + * + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns from [this] that are a subtype of the given type [C], optionally filtered + * by [filter]. + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + *      + * + * Alternatively, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also be called on existing columns: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"().`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + *      + * + * Finally, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also take a [KType] argument instead of a reified type. + * This is useful when the type is not known at compile time or when the API function cannot be inlined. + * + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<`[Int][Int]`> -> it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[colsOf][String.colsOf]`(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[colsOf][String.colsOf]`(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][DataColumn]`<`[Int][Int]`> -> it.`[size][DataColumn.size]` > 10 } }` + * + * @param [filter] an optional filter function that takes a column of type [C] and returns `true` if the column should be included. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns of given type that were included by [filter]. + */ + public fun String.colsOf(type: KType, filter: ColumnFilter = { true }): ColumnSet<*> = + columnGroup(this).colsOf(type, filter) + + /** + * ## Cols Of + * + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns from [this] that are a subtype of the given type [C], optionally filtered + * by [filter]. + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + *      + * + * Alternatively, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also be called on existing columns: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"().`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + *      + * + * Finally, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also take a [KType] argument instead of a reified type. + * This is useful when the type is not known at compile time or when the API function cannot be inlined. + * + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<`[Int][Int]`> -> it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[colsOf][KProperty.colsOf]`(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[colsOf][KProperty.colsOf]`(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][DataColumn]`<`[Int][Int]`> -> it.`[size][DataColumn.size]` > 10 } }` + * + * @param [filter] an optional filter function that takes a column of type [C] and returns `true` if the column should be included. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns of given type that were included by [filter]. + */ + public fun KProperty<*>.colsOf(type: KType, filter: ColumnFilter = { true }): ColumnSet<*> = + columnGroup(this).colsOf(type, filter) + + /** + * ## Cols Of + * + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns from [this] that are a subtype of the given type [C], optionally filtered + * by [filter]. + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + *      + * + * Alternatively, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also be called on existing columns: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"().`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + *      + * + * Finally, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also take a [KType] argument instead of a reified type. + * This is useful when the type is not known at compile time or when the API function cannot be inlined. + * + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<`[Int][Int]`> -> it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[colsOf][ColumnPath.colsOf]`(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[colsOf][ColumnPath.colsOf]`(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][DataColumn]`<`[Int][Int]`> -> it.`[size][DataColumn.size]` > 10 } }` + * + * @param [filter] an optional filter function that takes a column of type [C] and returns `true` if the column should be included. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns of given type that were included by [filter]. + */ + public fun ColumnPath.colsOf(type: KType, filter: ColumnFilter = { true }): ColumnSet<*> = + columnGroup(this).colsOf(type, filter) +} + +/** + * ## Cols Of + * + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns from [this] that are a subtype of the given type [C], optionally filtered + * by [filter]. + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + *      + * + * Alternatively, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also be called on existing columns: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"().`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + *      + * + * Finally, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also take a [KType] argument instead of a reified type. + * This is useful when the type is not known at compile time or when the API function cannot be inlined. + * + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<`[Int][Int]`> -> it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[colsOf][ColumnSet.colsOf]`(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[colsOf][ColumnSet.colsOf]`(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][DataColumn]`<`[Int][Int]`> -> it.`[size][DataColumn.size]` > 10 } }` + * + * @param [filter] an optional filter function that takes a column of type [C] and returns `true` if the column should be included. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns of given type that were included by [filter]. + */ +public fun ColumnSet<*>.colsOf(type: KType, filter: ColumnFilter = { true }): TransformableColumnSet = + colsOfInternal(type, filter) + +/** + * ## Cols Of + * + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns from [this] that are a subtype of the given type [C], optionally filtered + * by [filter]. + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + *      + * + * Alternatively, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also be called on existing columns: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"().`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + *      + * + * Finally, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also take a [KType] argument instead of a reified type. + * This is useful when the type is not known at compile time or when the API function cannot be inlined. + * + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<`[Int][Int]`> -> it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[colsOf][ColumnSet.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[colsOf][ColumnSet.colsOf]`<`[Int][Int]`> { it.`[size][DataColumn.size]` > 10 } }` + * + * @param [filter] an optional filter function that takes a column of type [C] and returns `true` if the column should be included. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns of given type that were included by [filter]. + */ +@Interpretable("ColsOf1") +public inline fun ColumnSet<*>.colsOf( + noinline filter: ColumnFilter = { true }, +): TransformableColumnSet = colsOf(typeOf(), filter) + +/** + * ## Cols Of + * + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns from [this] that are a subtype of the given type [C], optionally filtered + * by [filter]. + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + *      + * + * Alternatively, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also be called on existing columns: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"().`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + *      + * + * Finally, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also take a [KType] argument instead of a reified type. + * This is useful when the type is not known at compile time or when the API function cannot be inlined. + * + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<`[Int][Int]`> -> it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * @param [filter] an optional filter function that takes a column of type [C] and returns `true` if the column should be included. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns of given type that were included by [filter]. + */ +public fun ColumnsSelectionDsl<*>.colsOf( + type: KType, + filter: ColumnFilter = { true }, +): TransformableColumnSet = asSingleColumn().colsOf(type, filter) + +/** + * ## Cols Of + * + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns from [this] that are a subtype of the given type [C], optionally filtered + * by [filter]. + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + *      + * + * Alternatively, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also be called on existing columns: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"().`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + *      + * + * Finally, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also take a [KType] argument instead of a reified type. + * This is useful when the type is not known at compile time or when the API function cannot be inlined. + * + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<`[Int][Int]`> -> it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * @param [filter] an optional filter function that takes a column of type [C] and returns `true` if the column should be included. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns of given type that were included by [filter]. + */ +@Interpretable("ColsOf0") +public inline fun ColumnsSelectionDsl<*>.colsOf( + noinline filter: ColumnFilter = { true }, +): TransformableColumnSet = asSingleColumn().colsOf(typeOf(), filter) + +/** + * ## Cols Of + * + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns from [this] that are a subtype of the given type [C], optionally filtered + * by [filter]. + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + *      + * + * Alternatively, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also be called on existing columns: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"().`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + *      + * + * Finally, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also take a [KType] argument instead of a reified type. + * This is useful when the type is not known at compile time or when the API function cannot be inlined. + * + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<`[Int][Int]`> -> it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][DataColumn]`<`[Int][Int]`> -> it.`[size][DataColumn.size]` > 10 } }` + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * @param [filter] an optional filter function that takes a column of type [C] and returns `true` if the column should be included. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns of given type that were included by [filter]. + */ +public fun SingleColumn>.colsOf( + type: KType, + filter: ColumnFilter = { true }, +): TransformableColumnSet = ensureIsColumnGroup().colsOfInternal(type, filter) + +/** + * ## Cols Of + * + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns from [this] that are a subtype of the given type [C], optionally filtered + * by [filter]. + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + *      + * + * Alternatively, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also be called on existing columns: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup"().`[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + *      + * + * Finally, [colsOf][org.jetbrains.kotlinx.dataframe.api.ColsOfColumnsSelectionDsl.colsOf] can also take a [KType] argument instead of a reified type. + * This is useful when the type is not known at compile time or when the API function cannot be inlined. + * + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>(`[typeOf][typeOf]`<`[Int][Int]`>()) { it: `[DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]`<`[Int][Int]`> -> it.`[size][org.jetbrains.kotlinx.dataframe.DataColumn.size]` > 10 } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[colsOf][SingleColumn.colsOf]`<`[Int][Int]`> { it.`[size][DataColumn.size]` > 10 } }` + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>() }` + * + * @param [filter] an optional filter function that takes a column of type [C] and returns `true` if the column should be included. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns of given type that were included by [filter]. + */ +public inline fun SingleColumn>.colsOf( + noinline filter: ColumnFilter = { true }, +): TransformableColumnSet = colsOf(typeOf(), filter) + +/** + * If this [ColumnsResolver] is a [SingleColumn], it + * returns a new [ColumnSet] containing the columns inside of this [SingleColumn] that + * match the given [filter] and are the given [type]. + * + * Else, it returns a new [ColumnSet] containing all columns in this [ColumnsResolver] that + * match the given [filter] and are the given [type]. + */ +@Suppress("UNCHECKED_CAST") +internal fun ColumnsResolver<*>.colsOfInternal(type: KType, filter: ColumnFilter): TransformableColumnSet = + colsInternal { + it.isSubtypeOf(type) && filter(it.cast()) + } as TransformableColumnSet + +/* TODO: [Issue: #325, context receiver support](https://github.com/Kotlin/dataframe/issues/325) +context(ColumnsSelectionDsl) +public inline fun KProperty<*>.colsOf(noinline filter: (DataColumn) -> Boolean = { true }): ColumnSet<*> = + colsOf(typeOf(), filter) + +context(ColumnsSelectionDsl) +public inline fun String.colsOf(noinline filter: (DataColumn) -> Boolean = { true }): ColumnSet<*> = + colsOf(typeOf(), filter) + + */ + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsOfKind.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsOfKind.kt new file mode 100644 index 000000000..6a103d9c2 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/colsOfKind.kt @@ -0,0 +1,402 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnKind +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.documentation.AccessApi +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.headPlusArray +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Cols Of Kind [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface ColsOfKindColumnsSelectionDsl { + + /** + * ## Cols Of Kind Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * `kind: `[`ColumnKind`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`colsOfKind`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]**`(`**[`kind`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnKindDef]**`,`**` ..`**`)`**` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`colsOfKind`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]**`(`**[`kind`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnKindDef]**`,`**` ..`**`)`**` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`colsOfKind`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]**`(`**[`kind`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnKindDef]**`,`**` ..`**`)`**` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`colsOfKind`**][ColumnsSelectionDsl.colGroups] */ + public interface PlainDslName + + /** __`.`__[**`colsOfKind`**][ColumnsSelectionDsl.colGroups] */ + public interface ColumnSetName + + /** __`.`__[**`colsOfKind`**][ColumnsSelectionDsl.colGroups] */ + public interface ColumnGroupName + } + + /** + * ## Cols Of Kind + * Creates a subset of columns from [this] that are of the given kind(s). + * + * You can optionally use a [filter] to only include certain columns. + * [colsOfKind] can be called using any of the supported [APIs][AccessApi] (+ [ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { `[colsOfKind][ColumnsSelectionDsl.colsOfKind]`(`[Value][ColumnKind.Value]`, `[Frame][ColumnKind.Frame]`) { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { `[colsOfKind][ColumnsSelectionDsl.colsOfKind]`(`[Group][ColumnKind.Group]`) }` + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[colsOfKind][String.colsOfKind]`(`[Frame][ColumnKind.Frame]`) }` + * + * #### Examples for this overload: + * + * + * + * @param [filter] An optional [predicate][ColumnFilter] to filter the columns of given kind(s) by. + * @param [kind] The [kind][ColumnKind] of columns to include. + * @param [others] Other optional [kinds][ColumnKind] of columns to include. + * @return A [ColumnSet] of columns of the given kind(s). + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + private interface CommonColsOfKindDocs { + + /** Example argument */ + interface ExampleArg + } + + /** + * ## Cols Of Kind + * Creates a subset of columns from [this] that are of the given kind(s). + * + * You can optionally use a [filter] to only include certain columns. + * [colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.colsOfKind] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Value][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]`, `[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Group][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Group]`) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colsOfKind][kotlin.String.colsOfKind]`(`[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") }.`[colsOfKind][ColumnSet.colsOfKind]`(`[Value][ColumnKind.Value]`, `[Frame][ColumnKind.Frame]`) }` + * + * `// NOTE: This can be shortened to just:` + * + * `df.`[select][DataFrame.select]` { `[colsOfKind][ColumnsSelectionDsl.colsOfKind]`(`[Value][ColumnKind.Value]`, `[Frame][ColumnKind.Frame]`) { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.ColumnFilter] to filter the columns of given kind(s) by. + * @param [kind] The [kind][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @param [others] Other optional [kinds][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns of the given kind(s). + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun ColumnSet<*>.colsOfKind( + kind: ColumnKind, + vararg others: ColumnKind, + filter: ColumnFilter<*> = { true }, + ): TransformableColumnSet<*> = + columnsOfKindInternal( + kinds = headPlusArray(kind, others).toSet(), + filter = filter, + ) + + /** + * ## Cols Of Kind + * Creates a subset of columns from [this] that are of the given kind(s). + * + * You can optionally use a [filter] to only include certain columns. + * [colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.colsOfKind] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Value][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]`, `[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Group][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Group]`) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colsOfKind][kotlin.String.colsOfKind]`(`[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOfKind][ColumnsSelectionDsl.colsOfKind]`(`[Value][ColumnKind.Value]`, `[Frame][ColumnKind.Frame]`) { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.ColumnFilter] to filter the columns of given kind(s) by. + * @param [kind] The [kind][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @param [others] Other optional [kinds][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns of the given kind(s). + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun ColumnsSelectionDsl<*>.colsOfKind( + kind: ColumnKind, + vararg others: ColumnKind, + filter: ColumnFilter<*> = { true }, + ): TransformableColumnSet<*> = + asSingleColumn().columnsOfKindInternal( + kinds = headPlusArray(kind, others).toSet(), + filter = filter, + ) + + /** + * ## Cols Of Kind + * Creates a subset of columns from [this] that are of the given kind(s). + * + * You can optionally use a [filter] to only include certain columns. + * [colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.colsOfKind] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Value][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]`, `[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Group][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Group]`) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colsOfKind][kotlin.String.colsOfKind]`(`[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[colsOfKind][SingleColumn.colsOfKind]`(`[Value][ColumnKind.Value]`, `[Frame][ColumnKind.Frame]`) }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.ColumnFilter] to filter the columns of given kind(s) by. + * @param [kind] The [kind][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @param [others] Other optional [kinds][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns of the given kind(s). + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun SingleColumn>.colsOfKind( + kind: ColumnKind, + vararg others: ColumnKind, + filter: ColumnFilter<*> = { true }, + ): TransformableColumnSet<*> = + this.ensureIsColumnGroup().columnsOfKindInternal( + kinds = headPlusArray(kind, others).toSet(), + filter = filter, + ) + + /** + * ## Cols Of Kind + * Creates a subset of columns from [this] that are of the given kind(s). + * + * You can optionally use a [filter] to only include certain columns. + * [colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.colsOfKind] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Value][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]`, `[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Group][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Group]`) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colsOfKind][kotlin.String.colsOfKind]`(`[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[colsOfKind][SingleColumn.colsOfKind]`(`[Value][ColumnKind.Value]`, `[Frame][ColumnKind.Frame]`) }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.ColumnFilter] to filter the columns of given kind(s) by. + * @param [kind] The [kind][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @param [others] Other optional [kinds][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns of the given kind(s). + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun String.colsOfKind( + kind: ColumnKind, + vararg others: ColumnKind, + filter: ColumnFilter<*> = { true }, + ): TransformableColumnSet<*> = columnGroup(this).colsOfKind(kind, *others, filter = filter) + + /** + * ## Cols Of Kind + * Creates a subset of columns from [this] that are of the given kind(s). + * + * You can optionally use a [filter] to only include certain columns. + * [colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.colsOfKind] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Value][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]`, `[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Group][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Group]`) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colsOfKind][kotlin.String.colsOfKind]`(`[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[colsOfKind][KProperty.colsOfKind]`(`[Value][ColumnKind.Value]`, `[Frame][ColumnKind.Frame]`) }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.ColumnFilter] to filter the columns of given kind(s) by. + * @param [kind] The [kind][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @param [others] Other optional [kinds][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns of the given kind(s). + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun KProperty<*>.colsOfKind( + kind: ColumnKind, + vararg others: ColumnKind, + filter: ColumnFilter<*> = { true }, + ): TransformableColumnSet<*> = columnGroup(this).colsOfKind(kind, *others, filter = filter) + + /** + * ## Cols Of Kind + * Creates a subset of columns from [this] that are of the given kind(s). + * + * You can optionally use a [filter] to only include certain columns. + * [colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.colsOfKind] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColsOfKindColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Value][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]`, `[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOfKind][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOfKind]`(`[Group][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Group]`) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[colsOfKind][kotlin.String.colsOfKind]`(`[Frame][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Frame]`) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[colsOfKind][ColumnPath.colsOfKind]`(`[Value][ColumnKind.Value]`, `[Frame][ColumnKind.Frame]`) }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.ColumnFilter] to filter the columns of given kind(s) by. + * @param [kind] The [kind][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @param [others] Other optional [kinds][org.jetbrains.kotlinx.dataframe.columns.ColumnKind] of columns to include. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of columns of the given kind(s). + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun ColumnPath.colsOfKind( + kind: ColumnKind, + vararg others: ColumnKind, + filter: ColumnFilter<*> = { true }, + ): TransformableColumnSet<*> = columnGroup(this).colsOfKind(kind, *others, filter = filter) + + // endregion +} + +/** + * Returns a TransformableColumnSet containing the columns of given kind(s) that satisfy the given filter. + * + * @param filter The filter function to apply on each column. Must accept a ColumnWithPath object and return a Boolean. + * @return A [TransformableColumnSet] containing the columns of given kinds that satisfy the filter. + */ +internal fun ColumnsResolver<*>.columnsOfKindInternal( + kinds: Set, + filter: ColumnFilter<*>, +): TransformableColumnSet<*> = colsInternal { it.kind() in kinds && filter(it) } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/columnNameFilters.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/columnNameFilters.kt new file mode 100644 index 000000000..5c9b0d0ae --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/columnNameFilters.kt @@ -0,0 +1,1095 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## (Cols) Name (Contains / StartsWith / EndsWith) [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface ColumnNameFiltersColumnsSelectionDsl { + + /** + * ## (Cols) Name (Contains / StartsWith / EndsWith) Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `text: `[`String`][String] + * + *      + * + * `ignoreCase: `[`Boolean`][Boolean] + * + *      + * + * `regex: `[`Regex`][Regex] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`nameContains`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameContains]**`(`**[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`] | `[`regex`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.RegexDef]**`)`** + * + * `| `__`name`__`(`[**`Starts`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameStartsWith]`|`[**`Ends`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameEndsWith]`)`**`With`**__`(`__[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`]`**`)`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`nameContains`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameContains]**`(`**[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`] | `[`regex`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.RegexDef]**`)`** + * + *     `| `__`.name`__`(`[**`Starts`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameStartsWith]`|`[**`Ends`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.nameEndsWith]`)`**`With`**__`(`__[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`]`**`)`** + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`colsNameContains`**][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameContains]**`(`**[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`] | `[`regex`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.RegexDef]**`)`** + * + *     `| `__`.colsName`__`(`[**`Starts`**][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameStartsWith]`|`[**`Ends`**][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameEndsWith]`)`**`With`**__`(`__[`text`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.TextDef]`[`**`, `**[`ignoreCase`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IgnoreCaseDef]`]`**`)`** + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`nameContains`**][ColumnsSelectionDsl.nameContains] */ + public interface PlainDslNameContains + + /** __`name`__`(`[**`Starts`**][ColumnsSelectionDsl.nameStartsWith]`|`[**`Ends`**][ColumnsSelectionDsl.nameEndsWith]`)`**`With`** */ + public interface PlainDslNameStartsEndsWith + + /** __`.`__[**`nameContains`**][ColumnsSelectionDsl.nameContains] */ + public interface ColumnSetNameContains + + /** __`.name`__`(`[**`Starts`**][ColumnsSelectionDsl.nameStartsWith]`|`[**`Ends`**][ColumnsSelectionDsl.nameEndsWith]`)`**`With`** */ + public interface ColumnSetNameStartsEndsWith + + /**__`.`__[**`colsNameContains`**][ColumnsSelectionDsl.colsNameContains] */ + public interface ColumnGroupNameContains + + /** __`.colsName`__`(`[**`Starts`**][ColumnsSelectionDsl.colsNameStartsWith]`|`[**`Ends`**][ColumnsSelectionDsl.colsNameEndsWith]`)`**`With`** */ + public interface ColumnGroupNameStartsWith + } + + // region nameContains + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [text] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[text][text]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[nameContains][ColumnSet.nameContains]`("my") }` + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>().`[nameContains][ColumnSet.nameContains]`("my", ignoreCase = true) }` + * + * @param [text] what the column name should contain to be included in the result. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [text] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.nameContains( + text: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet = colsInternal { it.name.contains(text, ignoreCase) } as TransformableColumnSet + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [text] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[text][text]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[nameContains][ColumnsSelectionDsl.colsNameContains]`("my") }` + * + * @param [text] what the column name should contain to be included in the result. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [text] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + public fun ColumnsSelectionDsl<*>.nameContains( + text: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = asSingleColumn().colsNameContains(text, ignoreCase) + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [text] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[text][text]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { someGroupCol.`[colsNameContains][SingleColumn.colsNameContains]`("my") }` + * + * @param [text] what the column name should contain to be included in the result. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [text] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + public fun SingleColumn>.colsNameContains( + text: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = this.ensureIsColumnGroup().colsInternal { it.name.contains(text, ignoreCase) } + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [text] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[text][text]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "someGroupCol".`[colsNameContains][String.colsNameContains]`("my") }` + * + * @param [text] what the column name should contain to be included in the result. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [text] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + public fun String.colsNameContains(text: CharSequence, ignoreCase: Boolean = false): TransformableColumnSet<*> = + columnGroup(this).colsNameContains(text, ignoreCase) + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [text] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[text][text]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { DataSchemaType::someGroupCol.`[colsNameContains][KProperty.colsNameContains]`("my") }` + * + * @param [text] what the column name should contain to be included in the result. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [text] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + public fun KProperty<*>.colsNameContains( + text: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = columnGroup(this).colsNameContains(text, ignoreCase) + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [text] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[text][text]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["someGroupCol"].`[colsNameContains][ColumnPath.colsNameContains]`("my") }` + * + * @param [text] what the column name should contain to be included in the result. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [text] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + public fun ColumnPath.colsNameContains( + text: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = columnGroup(this).colsNameContains(text, ignoreCase) + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [regex] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[regex][regex]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * + * + * @param [regex] what the column name should contain to be included in the result. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [regex] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + private interface NameContainsRegexDocs + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [regex] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[regex][regex]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[nameContains][ColumnSet.nameContains]`(`[Regex][Regex]`("order-[0-9]+")) }` + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>().`[nameContains][ColumnSet.nameContains]`(`[Regex][Regex]`("order-[0-9]+")) }` + * + * @param [regex] what the column name should contain to be included in the result. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [regex] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.nameContains(regex: Regex): TransformableColumnSet = + colsInternal { it.name.contains(regex) } as TransformableColumnSet + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [regex] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[regex][regex]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[nameContains][ColumnsSelectionDsl.nameContains]`(`[Regex][Regex]`("order-[0-9]+")) }` + * + * @param [regex] what the column name should contain to be included in the result. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [regex] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + public fun ColumnsSelectionDsl<*>.nameContains(regex: Regex): TransformableColumnSet<*> = + asSingleColumn().colsNameContains(regex) + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [regex] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[regex][regex]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { someGroupCol.`[colsNameContains][SingleColumn.colsNameContains]`(`[Regex][Regex]`("order-[0-9]+")) }` + * + * @param [regex] what the column name should contain to be included in the result. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [regex] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + public fun SingleColumn>.colsNameContains(regex: Regex): TransformableColumnSet<*> = + this.ensureIsColumnGroup().colsInternal { it.name.contains(regex) } + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [regex] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[regex][regex]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "someGroupCol".`[colsNameContains][String.colsNameContains]`(`[Regex][Regex]`("order-[0-9]+")) }` + * + * @param [regex] what the column name should contain to be included in the result. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [regex] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + public fun String.colsNameContains(regex: Regex): TransformableColumnSet<*> = + columnGroup(this).colsNameContains(regex) + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [regex] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[regex][regex]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { DataSchemaType::someGroupCol.`[colsNameContains][KProperty.colsNameContains]`(`[Regex][Regex]`("order-[0-9]+")) }` + * + * @param [regex] what the column name should contain to be included in the result. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [regex] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + public fun KProperty<*>.colsNameContains(regex: Regex): TransformableColumnSet<*> = + columnGroup(this).colsNameContains(regex) + + /** + * ## (Cols) Name Contains + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] having + * [regex] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `nameContains` is named `colsNameContains` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { `[regex][regex]` `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[nameContains][kotlin.String.colsNameContains]`(`[Regex][Regex]`("my[a-zA-Z][a-zA-Z0-9]*")) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[nameContains][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsNameContains]`("my", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["someGroupCol"].`[colsNameContains][ColumnPath.colsNameContains]`(`[Regex][Regex]`("order-[0-9]+")) }` + * + * @param [regex] what the column name should contain to be included in the result. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns containing [regex] in their name. + * @see [nameEndsWith] + * @see [nameStartsWith] + * + */ + public fun ColumnPath.colsNameContains(regex: Regex): TransformableColumnSet<*> = + columnGroup(this).colsNameContains(regex) + + // endregion + + // region nameStartsWith + + @Deprecated("Use nameStartsWith instead", ReplaceWith("this.nameStartsWith(prefix)")) + public fun ColumnSet.startsWith(prefix: CharSequence): TransformableColumnSet = nameStartsWith(prefix) + + @Deprecated("Use nameStartsWith instead", ReplaceWith("this.nameStartsWith(prefix)")) + public fun ColumnsSelectionDsl<*>.startsWith(prefix: CharSequence): TransformableColumnSet<*> = + nameStartsWith(prefix) + + @Deprecated("Use colsNameStartsWith instead", ReplaceWith("this.colsNameStartsWith(prefix)")) + public fun SingleColumn>.startsWith(prefix: CharSequence): TransformableColumnSet<*> = + colsNameStartsWith(prefix) + + /** + * ## (Cols) Name Starts With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * starting with [prefix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameStartsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[startsWith][String.startsWith]`(`[prefix][prefix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameStartsWith][ColumnsSelectionDsl.nameStartsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameStartsWith][String.colsNameStartsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameStartsWith][SingleColumn.colsNameStartsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>().`[nameStartsWith][ColumnSet.nameStartsWith]`("order-") }` + * + * @param [prefix] Columns starting with this [prefix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns starting with [prefix] in their name. + * @see [nameEndsWith] + * @see [nameContains] + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.nameStartsWith( + prefix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet = colsInternal { it.name.startsWith(prefix, ignoreCase) } as TransformableColumnSet + + /** + * ## (Cols) Name Starts With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * starting with [prefix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameStartsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[startsWith][String.startsWith]`(`[prefix][prefix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameStartsWith][ColumnsSelectionDsl.nameStartsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameStartsWith][String.colsNameStartsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameStartsWith][SingleColumn.colsNameStartsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[nameStartsWith][ColumnsSelectionDsl.nameStartsWith]`("order-") }` + * + * @param [prefix] Columns starting with this [prefix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns starting with [prefix] in their name. + * @see [nameEndsWith] + * @see [nameContains] + */ + public fun ColumnsSelectionDsl<*>.nameStartsWith( + prefix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = asSingleColumn().colsNameStartsWith(prefix, ignoreCase) + + /** + * ## (Cols) Name Starts With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * starting with [prefix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameStartsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[startsWith][String.startsWith]`(`[prefix][prefix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameStartsWith][ColumnsSelectionDsl.nameStartsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameStartsWith][String.colsNameStartsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameStartsWith][SingleColumn.colsNameStartsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { someGroupCol.`[colsNameStartsWith][SingleColumn.colsNameStartsWith]`("order-") }` + * + * @param [prefix] Columns starting with this [prefix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns starting with [prefix] in their name. + * @see [nameEndsWith] + * @see [nameContains] + */ + public fun SingleColumn>.colsNameStartsWith( + prefix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = this.ensureIsColumnGroup().colsInternal { it.name.startsWith(prefix, ignoreCase) } + + /** + * ## (Cols) Name Starts With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * starting with [prefix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameStartsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[startsWith][String.startsWith]`(`[prefix][prefix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameStartsWith][ColumnsSelectionDsl.nameStartsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameStartsWith][String.colsNameStartsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameStartsWith][SingleColumn.colsNameStartsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "someGroupCol".`[colsNameStartsWith][String.colsNameStartsWith]`("order-") }` + * + * @param [prefix] Columns starting with this [prefix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns starting with [prefix] in their name. + * @see [nameEndsWith] + * @see [nameContains] + */ + public fun String.colsNameStartsWith( + prefix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = columnGroup(this).colsNameStartsWith(prefix, ignoreCase) + + /** + * ## (Cols) Name Starts With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * starting with [prefix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameStartsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[startsWith][String.startsWith]`(`[prefix][prefix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameStartsWith][ColumnsSelectionDsl.nameStartsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameStartsWith][String.colsNameStartsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameStartsWith][SingleColumn.colsNameStartsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { DataSchemaType::someGroupCol.`[colsNameStartsWith][KProperty.colsNameStartsWith]`("order-") }` + * + * @param [prefix] Columns starting with this [prefix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns starting with [prefix] in their name. + * @see [nameEndsWith] + * @see [nameContains] + */ + public fun KProperty<*>.colsNameStartsWith( + prefix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = columnGroup(this).colsNameStartsWith(prefix, ignoreCase) + + /** + * ## (Cols) Name Starts With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * starting with [prefix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameStartsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[startsWith][String.startsWith]`(`[prefix][prefix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameStartsWith][ColumnsSelectionDsl.nameStartsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameStartsWith][String.colsNameStartsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameStartsWith][SingleColumn.colsNameStartsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["someGroupCol"].`[colsNameStartsWith][ColumnPath.colsNameStartsWith]`("order-") }` + * + * @param [prefix] Columns starting with this [prefix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns starting with [prefix] in their name. + * @see [nameEndsWith] + * @see [nameContains] + */ + public fun ColumnPath.colsNameStartsWith( + prefix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = columnGroup(this).colsNameStartsWith(prefix, ignoreCase) + + // endregion + + // region nameEndsWith + + @Deprecated("Use nameEndsWith instead", ReplaceWith("this.nameEndsWith(suffix)")) + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.endsWith(suffix: CharSequence): TransformableColumnSet = + colsInternal { it.name.endsWith(suffix) } as TransformableColumnSet + + @Deprecated("Use nameEndsWith instead", ReplaceWith("this.nameEndsWith(suffix)")) + public fun ColumnsSelectionDsl<*>.endsWith(suffix: CharSequence): TransformableColumnSet<*> = nameEndsWith(suffix) + + @Deprecated("Use colsNameEndsWith instead", ReplaceWith("this.colsNameEndsWith(suffix)")) + public fun SingleColumn>.endsWith(suffix: CharSequence): TransformableColumnSet<*> = + this.ensureIsColumnGroup().colsInternal { it.name.endsWith(suffix) } + + /** + * ## (Cols) Name Ends With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * ending with [suffix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameEndsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[endsWith][String.endsWith]`(`[suffix][suffix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameEndsWith][ColumnsSelectionDsl.nameEndsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameEndsWith][String.colsNameEndsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameEndsWith][SingleColumn.colsNameEndsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>().`[nameEndsWith][ColumnSet.nameEndsWith]`("-order") }` + * + * @param [suffix] Columns ending with this [suffix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns ending with [suffix] in their name. + * @see [nameStartsWith] + * @see [nameContains] + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.nameEndsWith( + suffix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet = colsInternal { it.name.endsWith(suffix, ignoreCase) } as TransformableColumnSet + + /** + * ## (Cols) Name Ends With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * ending with [suffix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameEndsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[endsWith][String.endsWith]`(`[suffix][suffix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameEndsWith][ColumnsSelectionDsl.nameEndsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameEndsWith][String.colsNameEndsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameEndsWith][SingleColumn.colsNameEndsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[nameEndsWith][ColumnsSelectionDsl.nameEndsWith]`("-order") }` + * + * @param [suffix] Columns ending with this [suffix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns ending with [suffix] in their name. + * @see [nameStartsWith] + * @see [nameContains] + */ + public fun ColumnsSelectionDsl<*>.nameEndsWith( + suffix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = asSingleColumn().colsNameEndsWith(suffix, ignoreCase) + + /** + * ## (Cols) Name Ends With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * ending with [suffix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameEndsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[endsWith][String.endsWith]`(`[suffix][suffix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameEndsWith][ColumnsSelectionDsl.nameEndsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameEndsWith][String.colsNameEndsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameEndsWith][SingleColumn.colsNameEndsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { someGroupCol.`[colsNameEndsWith][SingleColumn.colsNameEndsWith]`("-order") }` + * + * @param [suffix] Columns ending with this [suffix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns ending with [suffix] in their name. + * @see [nameStartsWith] + * @see [nameContains] + */ + public fun SingleColumn>.colsNameEndsWith( + suffix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = this.ensureIsColumnGroup().colsInternal { it.name.endsWith(suffix, ignoreCase) } + + /** + * ## (Cols) Name Ends With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * ending with [suffix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameEndsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[endsWith][String.endsWith]`(`[suffix][suffix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameEndsWith][ColumnsSelectionDsl.nameEndsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameEndsWith][String.colsNameEndsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameEndsWith][SingleColumn.colsNameEndsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "someGroupCol".`[colsNameEndsWith][String.colsNameEndsWith]`("-order") }` + * + * @param [suffix] Columns ending with this [suffix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns ending with [suffix] in their name. + * @see [nameStartsWith] + * @see [nameContains] + */ + public fun String.colsNameEndsWith(suffix: CharSequence, ignoreCase: Boolean = false): TransformableColumnSet<*> = + columnGroup(this).colsNameEndsWith(suffix, ignoreCase) + + /** + * ## (Cols) Name Ends With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * ending with [suffix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameEndsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[endsWith][String.endsWith]`(`[suffix][suffix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameEndsWith][ColumnsSelectionDsl.nameEndsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameEndsWith][String.colsNameEndsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameEndsWith][SingleColumn.colsNameEndsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { DataSchemaType::someGroupCol.`[colsNameEndsWith][KProperty.colsNameEndsWith]`("-order") }` + * + * @param [suffix] Columns ending with this [suffix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns ending with [suffix] in their name. + * @see [nameStartsWith] + * @see [nameContains] + */ + public fun KProperty<*>.colsNameEndsWith( + suffix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = columnGroup(this).colsNameEndsWith(suffix, ignoreCase) + + /** + * ## (Cols) Name Ends With + * Returns a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] + * ending with [suffix] in their name. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], the function is named `colsNameEndsWith` to avoid confusion. + * + * This function is a shorthand for [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]`.`[endsWith][String.endsWith]`(`[suffix][suffix]`) }`. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[nameEndsWith][ColumnsSelectionDsl.nameEndsWith]`("order") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "someGroupCol".`[colsNameEndsWith][String.colsNameEndsWith]`("b") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::someGroupCol.`[colsNameEndsWith][SingleColumn.colsNameEndsWith]`("a", ignoreCase = true) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["someGroupCol"].`[colsNameEndsWith][ColumnPath.colsNameEndsWith]`("-order") }` + * + * @param [suffix] Columns ending with this [suffix] in their name will be returned. + * @param [ignoreCase] `true` to ignore character case when comparing strings. By default `false`. + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing + * all columns ending with [suffix] in their name. + * @see [nameStartsWith] + * @see [nameContains] + */ + public fun ColumnPath.colsNameEndsWith( + suffix: CharSequence, + ignoreCase: Boolean = false, + ): TransformableColumnSet<*> = columnGroup(this).colsNameEndsWith(suffix, ignoreCase) + + // endregion +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/columnRange.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/columnRange.kt new file mode 100644 index 000000000..ea63669d0 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/columnRange.kt @@ -0,0 +1,325 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.addPath +import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnSet +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Range of Columns [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface ColumnRangeColumnsSelectionDsl { + + /** + * ## Range of Columns Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` `[**`..`**][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.rangeTo]` `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef] + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`..`**][ColumnsSelectionDsl.rangeTo] */ + public interface PlainDslName + } + + /** + * ## Range of Columns + * Creates a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] up to (and including) [endInclusive]. + * + * Columns inside column groups are also supported (as long as they share the same direct parent), + * as well as any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { ``"fromColumn"`[`..`][String.rangeTo]`"toColumn"`` }` + * + * @param [endInclusive] The last column in the subset. + * @receiver The first column in the subset. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive]. + * @throws [IllegalArgumentException] if the columns have different parents or the end column is before the + * start column. + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * + */ + public operator fun String.rangeTo(endInclusive: String): ColumnSet<*> = + toColumnAccessor().rangeTo(endInclusive.toColumnAccessor()) + + /** + * ## Range of Columns + * Creates a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] up to (and including) [endInclusive]. + * + * Columns inside column groups are also supported (as long as they share the same direct parent), + * as well as any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { ``"fromColumn"`[`..`][String.rangeTo]`Type::toColumn`` }` + * + * @param [endInclusive] The last column in the subset. + * @receiver The first column in the subset. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive]. + * @throws [IllegalArgumentException] if the columns have different parents or the end column is before the + * start column. + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * + */ + public operator fun String.rangeTo(endInclusive: KProperty<*>): ColumnSet<*> = + toColumnAccessor().rangeTo(endInclusive.toColumnAccessor()) + + /** + * ## Range of Columns + * Creates a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] up to (and including) [endInclusive]. + * + * Columns inside column groups are also supported (as long as they share the same direct parent), + * as well as any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { ``"fromColumn"`[`..`][String.rangeTo]`toColumn`` }` + * + * @param [endInclusive] The last column in the subset. + * @receiver The first column in the subset. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive]. + * @throws [IllegalArgumentException] if the columns have different parents or the end column is before the + * start column. + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * + */ + public operator fun String.rangeTo(endInclusive: AnyColumnReference): ColumnSet<*> = + toColumnAccessor().rangeTo(endInclusive) + + /** + * ## Range of Columns + * Creates a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] up to (and including) [endInclusive]. + * + * Columns inside column groups are also supported (as long as they share the same direct parent), + * as well as any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { ``Type::fromColumn`[`..`][KProperty.rangeTo]`"toColumn"`` }` + * + * @param [endInclusive] The last column in the subset. + * @receiver The first column in the subset. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive]. + * @throws [IllegalArgumentException] if the columns have different parents or the end column is before the + * start column. + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * + */ + public operator fun KProperty<*>.rangeTo(endInclusive: String): ColumnSet<*> = + toColumnAccessor().rangeTo(endInclusive.toColumnAccessor()) + + /** + * ## Range of Columns + * Creates a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] up to (and including) [endInclusive]. + * + * Columns inside column groups are also supported (as long as they share the same direct parent), + * as well as any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { ``Type::fromColumn`[`..`][KProperty.rangeTo]`Type::toColumn`` }` + * + * @param [endInclusive] The last column in the subset. + * @receiver The first column in the subset. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive]. + * @throws [IllegalArgumentException] if the columns have different parents or the end column is before the + * start column. + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * + */ + public operator fun KProperty<*>.rangeTo(endInclusive: KProperty<*>): ColumnSet<*> = + toColumnAccessor().rangeTo(endInclusive.toColumnAccessor()) + + /** + * ## Range of Columns + * Creates a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] up to (and including) [endInclusive]. + * + * Columns inside column groups are also supported (as long as they share the same direct parent), + * as well as any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { ``Type::fromColumn`[`..`][KProperty.rangeTo]`toColumn`` }` + * + * @param [endInclusive] The last column in the subset. + * @receiver The first column in the subset. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive]. + * @throws [IllegalArgumentException] if the columns have different parents or the end column is before the + * start column. + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * + */ + public operator fun KProperty<*>.rangeTo(endInclusive: AnyColumnReference): ColumnSet<*> = + toColumnAccessor().rangeTo(endInclusive) + + /** + * ## Range of Columns + * Creates a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] up to (and including) [endInclusive]. + * + * Columns inside column groups are also supported (as long as they share the same direct parent), + * as well as any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { ``fromColumn`[`..`][ColumnReference.rangeTo]`"toColumn"`` }` + * + * @param [endInclusive] The last column in the subset. + * @receiver The first column in the subset. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive]. + * @throws [IllegalArgumentException] if the columns have different parents or the end column is before the + * start column. + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * + */ + public operator fun AnyColumnReference.rangeTo(endInclusive: String): ColumnSet<*> = + rangeTo(endInclusive.toColumnAccessor()) + + /** + * ## Range of Columns + * Creates a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] up to (and including) [endInclusive]. + * + * Columns inside column groups are also supported (as long as they share the same direct parent), + * as well as any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { ``fromColumn`[`..`][ColumnReference.rangeTo]`Type::toColumn`` }` + * + * @param [endInclusive] The last column in the subset. + * @receiver The first column in the subset. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive]. + * @throws [IllegalArgumentException] if the columns have different parents or the end column is before the + * start column. + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * + */ + public operator fun AnyColumnReference.rangeTo(endInclusive: KProperty<*>): ColumnSet<*> = + rangeTo(endInclusive.toColumnAccessor()) + + /** + * ## Range of Columns + * Creates a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] up to (and including) [endInclusive]. + * + * Columns inside column groups are also supported (as long as they share the same direct parent), + * as well as any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnRangeColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { ``fromColumn`[`..`][ColumnReference.rangeTo]`toColumn`` }` + * + * @param [endInclusive] The last column in the subset. + * @receiver The first column in the subset. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing all columns from [this] to [endInclusive]. + * @throws [IllegalArgumentException] if the columns have different parents or the end column is before the + * start column. + * @see [ColumnsSelectionDsl.allBefore] + * @see [ColumnsSelectionDsl.allAfter] + * @see [ColumnsSelectionDsl.allFrom] + * @see [ColumnsSelectionDsl.allUpTo] + * + */ + public operator fun AnyColumnReference.rangeTo(endInclusive: AnyColumnReference): ColumnSet<*> = + createColumnSet { context -> + val startPath = this@rangeTo.resolveSingle(context)!!.path + val endPath = endInclusive.resolveSingle(context)!!.path + val parentPath = startPath.parent() + val parentEndPath = endPath.parent() + require(parentPath == parentEndPath) { + "Start and end columns have different parent column paths: $parentPath and $parentEndPath" + } + val parentCol = context.df.getColumnGroup(parentPath!!) + val startIndex = parentCol.getColumnIndex(startPath.name) + val endIndex = parentCol.getColumnIndex(endPath.name) + + require(startIndex <= endIndex) { "End column is before start column" } + + (startIndex..endIndex).map { + parentCol.getColumn(it).let { + it.addPath(parentPath + it.name) + } + } + } +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/concat.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/concat.kt new file mode 100644 index 000000000..ced0b784a --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/concat.kt @@ -0,0 +1,59 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.values +import org.jetbrains.kotlinx.dataframe.impl.api.concatImpl +import org.jetbrains.kotlinx.dataframe.impl.asList + +// region DataColumn + +public fun DataColumn.concat(vararg other: DataColumn): DataColumn = concatImpl(name, listOf(this) + other) + +public fun DataColumn>.concat(): DataFrame = values.concat() + +public fun DataColumn>.concat(): List = values.flatten() + +// endregion + +// region DataRow + +public fun DataRow.concat(vararg rows: DataRow): DataFrame = (listOf(this) + rows).concat() + +// endregion + +// region DataFrame + +public fun DataFrame.concat(vararg frames: DataFrame): DataFrame = concatImpl(listOf(this) + frames) + +public infix fun DataFrame.concat(frame: DataFrame): DataFrame = concatImpl(listOf(this) + frame) + +@JvmName("concatT") +public fun DataFrame.concat(rows: Iterable>): DataFrame = (rows() + rows).concat() + +public fun DataFrame.concat(frames: Iterable>): DataFrame = (listOf(this) + frames).concat() + +// endregion + +// region GroupBy + +public fun GroupBy.concat(): DataFrame = groups.concat() + +// endregion + +// region Iterable + +public fun Iterable>.concat(): DataFrame = concatImpl(asList()) + +public fun Iterable>.concat(): DataColumn { + val list = asList() + if (list.isEmpty()) return DataColumn.empty().cast() + return concatImpl(list[0].name(), list) +} + +@JvmName("concatRows") +public fun Iterable?>.concat(): DataFrame = + concatImpl(map { it?.toDataFrame() ?: DataFrame.empty(1).cast() }) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt new file mode 100644 index 000000000..fbd77787b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt @@ -0,0 +1,431 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyBaseCol +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnGroupReference +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.exceptions.DuplicateColumnNamesException +import org.jetbrains.kotlinx.dataframe.exceptions.UnequalColumnSizesException +import org.jetbrains.kotlinx.dataframe.impl.ColumnNameGenerator +import org.jetbrains.kotlinx.dataframe.impl.DataFrameImpl +import org.jetbrains.kotlinx.dataframe.impl.UNNAMED_COLUMN_PREFIX +import org.jetbrains.kotlinx.dataframe.impl.api.withValuesImpl +import org.jetbrains.kotlinx.dataframe.impl.asList +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnAccessorImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.createColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.createComputedColumnReference +import org.jetbrains.kotlinx.dataframe.impl.columns.forceResolve +import org.jetbrains.kotlinx.dataframe.impl.columns.unbox +import org.jetbrains.kotlinx.dataframe.size +import kotlin.random.Random +import kotlin.random.nextInt +import kotlin.reflect.KProperty +import kotlin.reflect.full.withNullability +import kotlin.reflect.typeOf + +// region create ColumnAccessor + +// region column + +public fun column(): ColumnDelegate = ColumnDelegate() + +public fun column(name: String): ColumnAccessor = ColumnAccessorImpl(name) + +public fun column(path: ColumnPath): ColumnAccessor = ColumnAccessorImpl(path) + +public fun column(property: KProperty): ColumnAccessor = ColumnAccessorImpl(property.name) + +public fun ColumnGroupReference.column(): ColumnDelegate = ColumnDelegate(this) + +public fun ColumnGroupReference.column(name: String): ColumnAccessor = ColumnAccessorImpl(path() + name) + +public fun ColumnGroupReference.column(path: ColumnPath): ColumnAccessor = ColumnAccessorImpl(this.path() + path) + +public fun ColumnGroupReference.column(property: KProperty): ColumnAccessor = + ColumnAccessorImpl(this.path() + property.name) + +public inline fun column( + name: String = "", + infer: Infer = Infer.Nulls, + noinline expression: RowExpression, +): ColumnReference = createComputedColumnReference(name, typeOf(), infer, expression) + +@Suppress("UNCHECKED_CAST", "UNUSED_PARAMETER") +public inline fun column( + df: DataFrame, + name: String = "", + infer: Infer = Infer.Nulls, + noinline expression: RowExpression, +): ColumnReference = createComputedColumnReference(name, typeOf(), infer, expression as RowExpression) + +// endregion + +// region valueColumn + +public fun valueColumn(): ColumnDelegate = column() + +@JvmName("valueColumnTyped") +public fun valueColumn(): ColumnDelegate = column() + +public fun valueColumn(name: String): ColumnAccessor = column(name) + +@JvmName("valueColumnTyped") +public fun valueColumn(name: String): ColumnAccessor = column(name) + +public fun valueColumn(path: ColumnPath): ColumnAccessor = column(path) + +@JvmName("valueColumnTyped") +public fun valueColumn(path: ColumnPath): ColumnAccessor = column(path) + +public fun valueColumn(property: KProperty): ColumnAccessor = column(property.name) + +public fun ColumnGroupReference.valueColumn(): ColumnDelegate = ColumnDelegate(this) + +@JvmName("valueColumnTyped") +public fun ColumnGroupReference.valueColumn(): ColumnDelegate = ColumnDelegate(this) + +public fun ColumnGroupReference.valueColumn(name: String): ColumnAccessor = ColumnAccessorImpl(path() + name) + +@JvmName("valueColumnTyped") +public fun ColumnGroupReference.valueColumn(name: String): ColumnAccessor = ColumnAccessorImpl(path() + name) + +public fun ColumnGroupReference.valueColumn(path: ColumnPath): ColumnAccessor = + ColumnAccessorImpl(this.path() + path) + +@JvmName("valueColumnTyped") +public fun ColumnGroupReference.valueColumn(path: ColumnPath): ColumnAccessor = + ColumnAccessorImpl(this.path() + path) + +public fun ColumnGroupReference.valueColumn(property: KProperty): ColumnAccessor = + ColumnAccessorImpl(this.path() + property.name) + +// endregion + +// region columnGroup + +public fun columnGroup(): ColumnDelegate = column() + +@JvmName("columnGroupTyped") +public fun columnGroup(): ColumnDelegate> = column() + +public fun columnGroup(name: String): ColumnAccessor = column(name) + +@JvmName("columnGroupTyped") +public fun columnGroup(name: String): ColumnAccessor> = column(name) + +public fun columnGroup(path: ColumnPath): ColumnAccessor = column(path) + +@JvmName("columnGroupTyped") +public fun columnGroup(path: ColumnPath): ColumnAccessor> = column(path) + +@JvmName("columnGroupDataRowKProperty") +public fun columnGroup(property: KProperty>): ColumnAccessor> = column(property) + +public fun columnGroup(property: KProperty): ColumnAccessor> = column(property.name) + +public fun ColumnGroupReference.columnGroup(): ColumnDelegate = ColumnDelegate(this) + +@JvmName("columnGroupTyped") +public fun ColumnGroupReference.columnGroup(): ColumnDelegate> = ColumnDelegate(this) + +public fun ColumnGroupReference.columnGroup(name: String): ColumnAccessor = ColumnAccessorImpl(path() + name) + +@JvmName("columnGroupTyped") +public fun ColumnGroupReference.columnGroup(name: String): ColumnAccessor> = + ColumnAccessorImpl(path() + name) + +public fun ColumnGroupReference.columnGroup(path: ColumnPath): ColumnAccessor = + ColumnAccessorImpl(this.path() + path) + +@JvmName("columnGroupTyped") +public fun ColumnGroupReference.columnGroup(path: ColumnPath): ColumnAccessor> = + ColumnAccessorImpl(this.path() + path) + +@JvmName("columnGroupDataRowKProperty") +public fun ColumnGroupReference.columnGroup(property: KProperty>): ColumnAccessor> = + ColumnAccessorImpl(this.path() + property.name) + +public fun ColumnGroupReference.columnGroup(property: KProperty): ColumnAccessor> = + ColumnAccessorImpl(this.path() + property.name) + +// endregion + +// region frameColumn + +public fun frameColumn(): ColumnDelegate = column() + +@JvmName("frameColumnTyped") +public fun frameColumn(): ColumnDelegate> = column() + +public fun frameColumn(name: String): ColumnAccessor = column(name) + +@JvmName("frameColumnTyped") +public fun frameColumn(name: String): ColumnAccessor> = column(name) + +public fun frameColumn(path: ColumnPath): ColumnAccessor = column(path) + +@JvmName("frameColumnTyped") +public fun frameColumn(path: ColumnPath): ColumnAccessor> = column(path) + +@JvmName("frameColumnDataFrameKProperty") +public fun frameColumn(property: KProperty>): ColumnAccessor> = column(property) + +public fun frameColumn(property: KProperty>): ColumnAccessor> = column(property.name) + +public fun ColumnGroupReference.frameColumn(): ColumnDelegate = ColumnDelegate(this) + +@JvmName("frameColumnTyped") +public fun ColumnGroupReference.frameColumn(): ColumnDelegate> = ColumnDelegate(this) + +public fun ColumnGroupReference.frameColumn(name: String): ColumnAccessor = ColumnAccessorImpl(path() + name) + +@JvmName("frameColumnTyped") +public fun ColumnGroupReference.frameColumn(name: String): ColumnAccessor> = + ColumnAccessorImpl(path() + name) + +public fun ColumnGroupReference.frameColumn(path: ColumnPath): ColumnAccessor = + ColumnAccessorImpl(this.path() + path) + +@JvmName("frameColumnTyped") +public fun ColumnGroupReference.frameColumn(path: ColumnPath): ColumnAccessor> = + ColumnAccessorImpl(this.path() + path) + +@JvmName("frameColumnDataFrameKProperty") +public fun ColumnGroupReference.frameColumn(property: KProperty>): ColumnAccessor> = + ColumnAccessorImpl(this.path() + property.name) + +public fun ColumnGroupReference.frameColumn(property: KProperty>): ColumnAccessor> = + ColumnAccessorImpl(this.path() + property.name) + +// endregion + +public class ColumnDelegate(private val parent: ColumnGroupReference? = null) { + public operator fun getValue(thisRef: Any?, property: KProperty<*>): ColumnAccessor = named(property.columnName) + + public infix fun named(name: String): ColumnAccessor = + parent?.let { ColumnAccessorImpl(it.path() + name) } ?: ColumnAccessorImpl(name) +} + +// endregion + +// region create DataColumn + +public inline fun columnOf(vararg values: T): DataColumn = + createColumn(values.asIterable(), typeOf(), true).forceResolve() + +public fun columnOf(vararg values: AnyBaseCol): DataColumn = columnOf(values.asIterable()).forceResolve() + +public fun columnOf(vararg frames: DataFrame): FrameColumn = columnOf(frames.asIterable()).forceResolve() + +public fun columnOf(columns: Iterable): DataColumn = + DataColumn.createColumnGroup( + name = "", + df = dataFrameOf(columns), + ) + .asDataColumn() + .forceResolve() + +public fun columnOf(frames: Iterable>): FrameColumn = + DataColumn.createFrameColumn( + name = "", + groups = frames.toList(), + ).forceResolve() + +public inline fun column(values: Iterable): DataColumn = + createColumn(values, typeOf(), false).forceResolve() + +// endregion + +// region create DataFrame + +/** + * Creates new [DataFrame] with given [columns] + * + * All named columns must have unique names. For columns with empty names unique column names are generated: "untitled", "untitiled1", "untitled2" etc. + * + * All columns must have equal sizes. + * + * @throws [DuplicateColumnNamesException] if column names are not unique + * @throws [UnequalColumnSizesException] if column size are not equal + * @param columns columns for [DataFrame] + */ +public fun dataFrameOf(columns: Iterable): DataFrame<*> { + val cols = columns.map { it.unbox() } + val nrow = if (cols.isEmpty()) 0 else cols[0].size + return DataFrameImpl(cols, nrow) +} + +public fun dataFrameOf(vararg header: ColumnReference<*>): DataFrameBuilder = DataFrameBuilder(header.map { it.name() }) + +public fun dataFrameOf(vararg columns: AnyBaseCol): DataFrame<*> = dataFrameOf(columns.asIterable()) + +@Interpretable("DataFrameOf0") +public fun dataFrameOf(vararg header: String): DataFrameBuilder = dataFrameOf(header.toList()) + +public inline fun dataFrameOf(vararg header: String, fill: (String) -> Iterable): DataFrame<*> = + dataFrameOf(header.asIterable(), fill) + +public fun dataFrameOf(header: Iterable): DataFrameBuilder = DataFrameBuilder(header.asList()) + +@Refine +@Interpretable("DataFrameOf3") +public fun dataFrameOf(vararg columns: Pair>): DataFrame<*> = + columns.map { it.second.toColumn(it.first, Infer.Type) }.toDataFrame() + +public fun dataFrameOf(header: Iterable, values: Iterable): DataFrame<*> = + dataFrameOf(header).withValues(values) + +public inline fun dataFrameOf(header: Iterable, fill: (T) -> Iterable): DataFrame<*> = + header.map { value -> + fill(value).asList().let { + DataColumn.create(value.toString(), it) + } + }.toDataFrame() + +public fun dataFrameOf(header: CharProgression): DataFrameBuilder = dataFrameOf(header.map { it.toString() }) + +public class DataFrameBuilder(private val header: List) { + + public operator fun invoke(vararg columns: AnyCol): DataFrame<*> = invoke(columns.asIterable()) + + public operator fun invoke(columns: Iterable): DataFrame<*> { + val cols = columns.asList() + require(cols.size == header.size) { "Number of columns differs from number of column names" } + return cols.mapIndexed { i, col -> + col.rename(header[i]) + }.toDataFrame() + } + + @Refine + @Interpretable("DataFrameBuilderInvoke0") + public operator fun invoke(vararg values: Any?): DataFrame<*> = withValues(values.asIterable()) + + @JvmName("invoke1") + internal fun withValues(values: Iterable): DataFrame<*> = + withValuesImpl(header, values.asList()).map { (name, values) -> + DataColumn.createWithTypeInference(name, values) + }.toDataFrame() + + public operator fun invoke(args: Sequence): DataFrame<*> = invoke(*args.toList().toTypedArray()) + + public fun withColumns(columnBuilder: (String) -> AnyCol): DataFrame<*> = header.map(columnBuilder).toDataFrame() + + public inline operator fun invoke(crossinline valuesBuilder: (String) -> Iterable): DataFrame<*> = + withColumns { name -> + valuesBuilder(name).let { + DataColumn.create( + name = name, + values = it.asList(), + ) + } + } + + public inline fun fill(nrow: Int, value: C): DataFrame<*> = + withColumns { name -> + DataColumn.createValueColumn( + name = name, + values = List(nrow) { value }, + type = typeOf().withNullability(value == null), + ) + } + + public inline fun nulls(nrow: Int): DataFrame<*> = fill(nrow, null) + + public inline fun fillIndexed(nrow: Int, crossinline init: (Int, String) -> C): DataFrame<*> = + withColumns { name -> + DataColumn.create( + name, + List(nrow) { init(it, name) }, + ) + } + + public inline fun fill(nrow: Int, crossinline init: (Int) -> C): DataFrame<*> = + withColumns { name -> + DataColumn.create( + name = name, + values = List(nrow, init), + ) + } + + private inline fun fillNotNull(nrow: Int, crossinline init: (Int) -> C) = + withColumns { name -> + DataColumn.createValueColumn( + name = name, + values = List(nrow, init), + type = typeOf(), + ) + } + + public fun randomInt(nrow: Int): DataFrame<*> = fillNotNull(nrow) { Random.nextInt() } + + public fun randomInt(nrow: Int, range: IntRange): DataFrame<*> = fillNotNull(nrow) { Random.nextInt(range) } + + public fun randomDouble(nrow: Int): DataFrame<*> = fillNotNull(nrow) { Random.nextDouble() } + + public fun randomDouble(nrow: Int, range: ClosedRange): DataFrame<*> = + fillNotNull(nrow) { Random.nextDouble(range.start, range.endInclusive) } + + public fun randomFloat(nrow: Int): DataFrame<*> = fillNotNull(nrow) { Random.nextFloat() } + + public fun randomLong(nrow: Int): DataFrame<*> = fillNotNull(nrow) { Random.nextLong() } + + public fun randomLong(nrow: Int, range: ClosedRange): DataFrame<*> = + fillNotNull(nrow) { Random.nextLong(range.start, range.endInclusive) } + + public fun randomBoolean(nrow: Int): DataFrame<*> = fillNotNull(nrow) { Random.nextBoolean() } +} + +/** + * Helper class for implementing operations when column names can be potentially duplicated. + * For example, operations involving multiple dataframes, computed columns or parsing some third-party data + */ +public class DynamicDataFrameBuilder { + private var cols: MutableList = mutableListOf() + private val generator = ColumnNameGenerator() + + public fun add(col: AnyCol): String { + val uniqueName = if (col.name().isEmpty()) { + generator.addUnique(UNNAMED_COLUMN_PREFIX) + } else { + generator.addUnique(col.name()) + } + val renamed = if (uniqueName != col.name()) { + col.rename(uniqueName) + } else { + col + } + cols.add(renamed) + return uniqueName + } + + public fun toDataFrame(): DataFrame<*> = dataFrameOf(cols) +} + +/** + * Returns [DataFrame] with no rows and no columns. + * + * To create [DataFrame] with empty columns or empty rows see [DataFrame.empty] + * + * @param T schema marker for [DataFrame] + */ +public fun emptyDataFrame(): DataFrame = DataFrame.empty().cast() + +// endregion + +// region create ColumnPath + +public fun pathOf(vararg columnNames: String): ColumnPath = ColumnPath(columnNames.asList()) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/convert.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/convert.kt new file mode 100644 index 000000000..aa3aacd82 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/convert.kt @@ -0,0 +1,489 @@ +package org.jetbrains.kotlinx.dataframe.api + +import kotlinx.datetime.Instant +import kotlinx.datetime.LocalDate +import kotlinx.datetime.LocalDateTime +import kotlinx.datetime.LocalTime +import kotlinx.datetime.TimeZone +import kotlinx.datetime.toLocalDateTime +import org.jetbrains.kotlinx.dataframe.AnyBaseCol +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.ColumnsContainer +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowColumnExpression +import org.jetbrains.kotlinx.dataframe.RowValueExpression +import org.jetbrains.kotlinx.dataframe.annotations.HasSchema +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.dataTypes.IFRAME +import org.jetbrains.kotlinx.dataframe.dataTypes.IMG +import org.jetbrains.kotlinx.dataframe.exceptions.CellConversionException +import org.jetbrains.kotlinx.dataframe.exceptions.TypeConversionException +import org.jetbrains.kotlinx.dataframe.impl.api.Parsers +import org.jetbrains.kotlinx.dataframe.impl.api.convertRowColumnImpl +import org.jetbrains.kotlinx.dataframe.impl.api.convertToTypeImpl +import org.jetbrains.kotlinx.dataframe.impl.api.defaultTimeZone +import org.jetbrains.kotlinx.dataframe.impl.api.toLocalDate +import org.jetbrains.kotlinx.dataframe.impl.api.toLocalDateTime +import org.jetbrains.kotlinx.dataframe.impl.api.toLocalTime +import org.jetbrains.kotlinx.dataframe.impl.api.withRowCellImpl +import org.jetbrains.kotlinx.dataframe.impl.headPlusArray +import org.jetbrains.kotlinx.dataframe.io.toDataFrame +import org.jetbrains.kotlinx.dataframe.path +import java.math.BigDecimal +import java.net.URL +import java.util.Locale +import kotlin.reflect.KProperty +import kotlin.reflect.KType +import kotlin.reflect.full.isSubtypeOf +import kotlin.reflect.full.withNullability +import kotlin.reflect.typeOf + +@Interpretable("Convert0") +public fun DataFrame.convert(columns: ColumnsSelector): Convert = Convert(this, columns) + +public fun DataFrame.convert(vararg columns: KProperty): Convert = convert { columns.toColumnSet() } + +@Interpretable("Convert2") +public fun DataFrame.convert(vararg columns: String): Convert = convert { columns.toColumnSet() } + +public fun DataFrame.convert(vararg columns: ColumnReference): Convert = + convert { columns.toColumnSet() } + +public inline fun DataFrame.convert( + firstCol: ColumnReference, + vararg cols: ColumnReference, + infer: Infer = Infer.Nulls, + noinline expression: RowValueExpression, +): DataFrame = convert(*headPlusArray(firstCol, cols)).with(infer, expression) + +public inline fun DataFrame.convert( + firstCol: KProperty, + vararg cols: KProperty, + infer: Infer = Infer.Nulls, + noinline expression: RowValueExpression, +): DataFrame = convert(*headPlusArray(firstCol, cols)).with(infer, expression) + +@Interpretable("Convert6") +public inline fun DataFrame.convert( + firstCol: String, + vararg cols: String, + infer: Infer = Infer.Nulls, + noinline expression: RowValueExpression, +): DataFrame = convert(*headPlusArray(firstCol, cols)).with(infer, expression) + +public inline fun Convert.notNull( + crossinline expression: RowValueExpression, +): DataFrame = + with { + if (it == null) { + null + } else { + expression(this, it) + } + } + +@HasSchema(schemaArg = 0) +public class Convert(internal val df: DataFrame, internal val columns: ColumnsSelector) { + public fun cast(): Convert = Convert(df, columns as ColumnsSelector) + + @Refine + @Interpretable("To0") + public inline fun to(): DataFrame = to(typeOf()) + + override fun toString(): String = "Convert(df=$df, columns=$columns)" +} + +public fun Convert.to(type: KType): DataFrame = to { it.convertTo(type) } + +public fun Convert.to(columnConverter: DataFrame.(DataColumn) -> AnyBaseCol): DataFrame = + df.replace(columns).with { columnConverter(df, it) } + +@Interpretable("With0") +public inline fun Convert.with( + infer: Infer = Infer.Nulls, + noinline rowConverter: RowValueExpression, +): DataFrame = withRowCellImpl(typeOf(), infer, rowConverter) + +@Refine +@Interpretable("With0") +public inline fun Convert.with( + noinline rowConverter: RowValueExpression, +): DataFrame = with(Infer.Nulls, rowConverter) + +public fun Convert>.asFrame( + body: ColumnsContainer.(ColumnGroup) -> DataFrame, +): DataFrame = to { body(this, it.asColumnGroup()).asColumnGroup(it.name()) } + +public inline fun Convert.perRowCol( + infer: Infer = Infer.Nulls, + noinline expression: RowColumnExpression, +): DataFrame = convertRowColumnImpl(typeOf(), infer, expression) + +public inline fun AnyCol.convertTo(): DataColumn = convertTo(typeOf()) as DataColumn + +public fun AnyCol.convertTo(newType: KType): AnyCol { + val isTypesAreCorrect = this.type().withNullability(true).isSubtypeOf(typeOf()) && + newType.withNullability(true) == typeOf() + + if (isTypesAreCorrect) { + return (this as DataColumn).convertToDouble().setNullable(newType.isMarkedNullable) + } + return convertToTypeImpl(newType) +} + +@JvmName("convertToLocalDateTimeFromT") +public fun DataColumn.convertToLocalDateTime(): DataColumn = convertTo() + +public fun DataColumn.convertToLocalDateTime(): DataColumn = convertTo() + +@JvmName("convertToLocalDateFromT") +public fun DataColumn.convertToLocalDate(): DataColumn = convertTo() + +public fun DataColumn.convertToLocalDate(): DataColumn = convertTo() + +@JvmName("convertToLocalTimeFromT") +public fun DataColumn.convertToLocalTime(): DataColumn = convertTo() + +public fun DataColumn.convertToLocalTime(): DataColumn = convertTo() + +@JvmName("convertToByteFromT") +public fun DataColumn.convertToByte(): DataColumn = convertTo() + +public fun DataColumn.convertToByte(): DataColumn = convertTo() + +@JvmName("convertToShortFromT") +public fun DataColumn.convertToShort(): DataColumn = convertTo() + +public fun DataColumn.convertToShort(): DataColumn = convertTo() + +@JvmName("convertToIntFromT") +public fun DataColumn.convertToInt(): DataColumn = convertTo() + +public fun DataColumn.convertToInt(): DataColumn = convertTo() + +@JvmName("convertToLongFromT") +public fun DataColumn.convertToLong(): DataColumn = convertTo() + +public fun DataColumn.convertToLong(): DataColumn = convertTo() + +@JvmName("convertToStringFromT") +public fun DataColumn.convertToString(): DataColumn = convertTo() + +public fun DataColumn.convertToString(): DataColumn = convertTo() + +@JvmName("convertToDoubleFromT") +public fun DataColumn.convertToDouble(): DataColumn = convertTo() + +public fun DataColumn.convertToDouble(): DataColumn = convertTo() + +/** + * Parse String column to Double considering locale (number format). + * If [locale] parameter is defined, it's number format is used for parsing. + * If [locale] parameter is null, the current system locale is used. If column can not be parsed, then POSIX format is used. + */ +@JvmName("convertToDoubleFromString") +public fun DataColumn.convertToDouble(locale: Locale? = null): DataColumn = + this.castToNullable().convertToDouble(locale).castToNotNullable() + +/** + * Parse String column to Double considering locale (number format). + * If [locale] parameter is defined, it's number format is used for parsing. + * If [locale] parameter is null, the current system locale is used. If column can not be parsed, then POSIX format is used. + */ +@JvmName("convertToDoubleFromStringNullable") +public fun DataColumn.convertToDouble(locale: Locale? = null): DataColumn { + fun applyParser(parser: (String) -> Double?): DataColumn { + var currentRow = 0 + try { + return mapIndexed { row, value -> + currentRow = row + value?.let { + parser(value.trim()) ?: throw TypeConversionException( + value = value, + from = typeOf(), + to = typeOf(), + column = path, + ) + } + } + } catch (e: TypeConversionException) { + throw CellConversionException(e.value, e.from, e.to, path, currentRow, e) + } + } + + return if (locale != null) { + val explicitParser = Parsers.getDoubleParser(locale) + applyParser(explicitParser) + } else { + try { + val defaultParser = Parsers.getDoubleParser() + applyParser(defaultParser) + } catch (e: TypeConversionException) { + val posixParser = Parsers.getDoubleParser(Locale.forLanguageTag("C.UTF-8")) + applyParser(posixParser) + } + } +} + +@JvmName("convertToFloatFromT") +public fun DataColumn.convertToFloat(): DataColumn = convertTo() + +public fun DataColumn.convertToFloat(): DataColumn = convertTo() + +@JvmName("convertToBigDecimalFromT") +public fun DataColumn.convertToBigDecimal(): DataColumn = convertTo() + +public fun DataColumn.convertToBigDecimal(): DataColumn = convertTo() + +@JvmName("convertToBooleanFromT") +public fun DataColumn.convertToBoolean(): DataColumn = convertTo() + +public fun DataColumn.convertToBoolean(): DataColumn = convertTo() + +// region convert URL + +public fun Convert.toIFrame( + border: Boolean = false, + width: Int? = null, + height: Int? = null, +): DataFrame = to { it.map { IFRAME(it.toString(), border, width, height) } } + +public fun Convert.toImg(width: Int? = null, height: Int? = null): DataFrame = + to { it.map { IMG(it.toString(), width, height) } } + +// endregion + +// region toURL + +public fun DataColumn.convertToURL(): DataColumn = map { URL(it) } + +@JvmName("convertToURLFromStringNullable") +public fun DataColumn.convertToURL(): DataColumn = map { it?.let { URL(it) } } + +public fun Convert.toURL(): DataFrame = to { it.convertToURL() } + +// endregion + +// region toInstant + +public fun DataColumn.convertToInstant(): DataColumn = map { Instant.parse(it) } + +@JvmName("convertToInstantFromStringNullable") +public fun DataColumn.convertToInstant(): DataColumn = map { it?.let { Instant.parse(it) } } + +public fun Convert.toInstant(): DataFrame = to { it.convertToInstant() } + +// endregion + +// region toLocalDate + +@JvmName("convertToLocalDateFromLong") +public fun DataColumn.convertToLocalDate(zone: TimeZone = defaultTimeZone): DataColumn = + map { it.toLocalDate(zone) } + +public fun DataColumn.convertToLocalDate(zone: TimeZone = defaultTimeZone): DataColumn = + map { it?.toLocalDate(zone) } + +@JvmName("convertToLocalDateFromInt") +public fun DataColumn.convertToLocalDate(zone: TimeZone = defaultTimeZone): DataColumn = + map { it.toLong().toLocalDate(zone) } + +@JvmName("convertToLocalDateFromIntNullable") +public fun DataColumn.convertToLocalDate(zone: TimeZone = defaultTimeZone): DataColumn = + map { it?.toLong()?.toLocalDate(zone) } + +@JvmName("convertToLocalDateFromString") +public fun DataColumn.convertToLocalDate( + pattern: String? = null, + locale: Locale? = null, +): DataColumn { + val converter = Parsers.getDateTimeConverter(LocalDate::class, pattern, locale) + return map { converter(it.trim()) ?: error("Can't convert `$it` to LocalDate") } +} + +@JvmName("convertToLocalDateFromStringNullable") +public fun DataColumn.convertToLocalDate( + pattern: String? = null, + locale: Locale? = null, +): DataColumn { + val converter = Parsers.getDateTimeConverter(LocalDate::class, pattern, locale) + return map { it?.let { converter(it.trim()) ?: error("Can't convert `$it` to LocalDate") } } +} + +@JvmName("toLocalDateFromTLong") +public fun Convert.toLocalDate(zone: TimeZone = defaultTimeZone): DataFrame = + to { it.convertToLocalDate(zone) } + +@JvmName("toLocalDateFromTInt") +public fun Convert.toLocalDate(zone: TimeZone = defaultTimeZone): DataFrame = + to { it.convertToLocalDate(zone) } + +public fun Convert.toLocalDate(pattern: String? = null, locale: Locale? = null): DataFrame = + to { it.convertToLocalDate(pattern, locale) } + +public fun Convert.toLocalDate(): DataFrame = to { it.convertTo() } + +// endregion + +// region toLocalTime + +@JvmName("convertToLocalTimeFromLong") +public fun DataColumn.convertToLocalTime(zone: TimeZone = defaultTimeZone): DataColumn = + map { it.toLocalTime(zone) } + +public fun DataColumn.convertToLocalTime(zone: TimeZone = defaultTimeZone): DataColumn = + map { it?.toLocalTime(zone) } + +@JvmName("convertToLocalTimeFromInt") +public fun DataColumn.convertToLocalTime(zone: TimeZone = defaultTimeZone): DataColumn = + map { it.toLong().toLocalTime(zone) } + +@JvmName("convertToLocalTimeIntNullable") +public fun DataColumn.convertToLocalTime(zone: TimeZone = defaultTimeZone): DataColumn = + map { it?.toLong()?.toLocalTime(zone) } + +@JvmName("convertToLocalTimeFromString") +public fun DataColumn.convertToLocalTime( + pattern: String? = null, + locale: Locale? = null, +): DataColumn { + val converter = Parsers.getDateTimeConverter(LocalTime::class, pattern, locale) + return map { converter(it.trim()) ?: error("Can't convert `$it` to LocalTime") } +} + +@JvmName("convertToLocalTimeFromStringNullable") +public fun DataColumn.convertToLocalTime( + pattern: String? = null, + locale: Locale? = null, +): DataColumn { + val converter = Parsers.getDateTimeConverter(LocalTime::class, pattern, locale) + return map { it?.let { converter(it.trim()) ?: error("Can't convert `$it` to LocalTime") } } +} + +@JvmName("toLocalTimeFromTLong") +public fun Convert.toLocalTime(zone: TimeZone = defaultTimeZone): DataFrame = + to { it.convertToLocalTime(zone) } + +@JvmName("toLocalTimeFromTInt") +public fun Convert.toLocalTime(zone: TimeZone = defaultTimeZone): DataFrame = + to { it.convertToLocalTime(zone) } + +public fun Convert.toLocalTime(pattern: String? = null, locale: Locale? = null): DataFrame = + to { it.convertToLocalTime(pattern, locale) } + +public fun Convert.toLocalTime(): DataFrame = to { it.convertTo() } + +// endregion + +// region toLocalDateTime + +@JvmName("convertToLocalDateTimeFromLong") +public fun DataColumn.convertToLocalDateTime(zone: TimeZone = defaultTimeZone): DataColumn = + map { it.toLocalDateTime(zone) } + +public fun DataColumn.convertToLocalDateTime(zone: TimeZone = defaultTimeZone): DataColumn = + map { it?.toLocalDateTime(zone) } + +@JvmName("convertToLocalDateTimeFromInstant") +public fun DataColumn.convertToLocalDateTime(zone: TimeZone = defaultTimeZone): DataColumn = + map { it.toLocalDateTime(zone) } + +@JvmName("convertToLocalDateTimeFromInstantNullable") +public fun DataColumn.convertToLocalDateTime(zone: TimeZone = defaultTimeZone): DataColumn = + map { it?.toLocalDateTime(zone) } + +@JvmName("convertToLocalDateTimeFromInt") +public fun DataColumn.convertToLocalDateTime(zone: TimeZone = defaultTimeZone): DataColumn = + map { it.toLong().toLocalDateTime(zone) } + +@JvmName("convertToLocalDateTimeFromIntNullable") +public fun DataColumn.convertToLocalDateTime(zone: TimeZone = defaultTimeZone): DataColumn = + map { it?.toLong()?.toLocalDateTime(zone) } + +@JvmName("convertToLocalDateTimeFromString") +public fun DataColumn.convertToLocalDateTime( + pattern: String? = null, + locale: Locale? = null, +): DataColumn { + val converter = Parsers.getDateTimeConverter(LocalDateTime::class, pattern, locale) + return map { converter(it.trim()) ?: error("Can't convert `$it` to LocalDateTime") } +} + +@JvmName("convertToLocalDateTimeFromStringNullable") +public fun DataColumn.convertToLocalDateTime( + pattern: String? = null, + locale: Locale? = null, +): DataColumn { + val converter = Parsers.getDateTimeConverter(LocalDateTime::class, pattern, locale) + return map { it?.let { converter(it.trim()) ?: error("Can't convert `$it` to LocalDateTime") } } +} + +@JvmName("toLocalDateTimeFromTLong") +public fun Convert.toLocalDateTime(zone: TimeZone = defaultTimeZone): DataFrame = + to { it.convertToLocalDateTime(zone) } + +@JvmName("toLocalDateTimeFromTInstant") +public fun Convert.toLocalDateTime(zone: TimeZone = defaultTimeZone): DataFrame = + to { it.convertToLocalDateTime(zone) } + +@JvmName("toLocalDateTimeFromTInt") +public fun Convert.toLocalDateTime(zone: TimeZone = defaultTimeZone): DataFrame = + to { it.convertToLocalDateTime(zone) } + +public fun Convert.toLocalDateTime( + pattern: String? = null, + locale: Locale? = null, +): DataFrame = to { it.convertToLocalDateTime(pattern, locale) } + +public fun Convert.toLocalDateTime(): DataFrame = to { it.convertTo() } + +// endregion + +@JvmName("toIntTAny") +public fun Convert.toInt(): DataFrame = to() + +public fun Convert.toInt(): DataFrame = to() + +@JvmName("toLongTAny") +public fun Convert.toLong(): DataFrame = to() + +public fun Convert.toLong(): DataFrame = to() + +@JvmName("toStrTAny") +public fun Convert.toStr(): DataFrame = to() + +public fun Convert.toStr(): DataFrame = to() + +@JvmName("toDoubleTAny") +public fun Convert.toDouble(): DataFrame = to() + +public fun Convert.toDouble(): DataFrame = to() + +@JvmName("toFloatTAny") +public fun Convert.toFloat(): DataFrame = to() + +public fun Convert.toFloat(): DataFrame = to() + +@JvmName("toBigDecimalTAny") +public fun Convert.toBigDecimal(): DataFrame = to() + +public fun Convert.toBigDecimal(): DataFrame = to() + +@JvmName("toBooleanTAny") +public fun Convert.toBoolean(): DataFrame = to() + +public fun Convert.toBoolean(): DataFrame = to() + +public fun Convert>>.toDataFrames(containsColumns: Boolean = false): DataFrame = + to { it.toDataFrames(containsColumns) } + +public fun DataColumn>>.toDataFrames(containsColumns: Boolean = false): DataColumn = + map { it.toDataFrame(containsColumns) } diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/convertTo.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/convertTo.kt new file mode 100644 index 000000000..70f295494 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/convertTo.kt @@ -0,0 +1,236 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.exceptions.ColumnNotFoundException +import org.jetbrains.kotlinx.dataframe.exceptions.ExcessiveColumnsException +import org.jetbrains.kotlinx.dataframe.exceptions.TypeConversionException +import org.jetbrains.kotlinx.dataframe.exceptions.TypeConverterNotFoundException +import org.jetbrains.kotlinx.dataframe.impl.api.ConvertSchemaDslInternal +import org.jetbrains.kotlinx.dataframe.impl.api.convertToImpl +import org.jetbrains.kotlinx.dataframe.schema.ColumnSchema +import kotlin.reflect.KProperty +import kotlin.reflect.KType +import kotlin.reflect.typeOf + +/** + * Specifies how to handle columns in original dataframe that were not matched to any column in destination dataframe schema. + */ +public enum class ExcessiveColumns { + /** + * Remove excessive columns from resulting dataframe + */ + Remove, + + /** + * Keep excessive columns in resulting dataframe + */ + Keep, + + /** + * Throw [ExcessiveColumnsException] if any excessive columns were found in the original dataframe + */ + Fail, +} + +/** + * Holds data context for [fill] operation + */ +public data class ConvertToFill(internal val dsl: ConvertSchemaDsl, val columns: ColumnsSelector) + +/** Provides access to [fromType] and [toSchema] in the flexible [ConvertSchemaDsl.convertIf] method. */ +public class ConverterScope(public val fromType: KType, public val toSchema: ColumnSchema) + +/** + * Dsl to customize column conversion + * + * Example: + * ```kotlin + * df.convertTo { + * // defines how to convert Int? -> String + * convert().with { it?.toString() ?: "No input given" } + * // defines how to convert String -> SomeType + * parser { SomeType(it) } + * // fill missing column `sum` with expression `a+b` + * fill { sum }.with { a + b } + * } + * ``` + */ +public interface ConvertSchemaDsl { + + /** + * Defines how to convert [from]: [A] to [to]: [B]. + * + * Note: In most cases using `convert().with { }` is more convenient, however + * if you only have [KType], this method can be used. + */ + public fun convert(from: KType, to: KType, converter: (A) -> B) + + /** + * Advanced version of [convert]. + * If you want to define a common conversion for multiple types (or any type), or + * you need extra information about the target, such as its schema, use this method. + * + * The exact type conversion does have higher priority. After that, this flexible conversions will be checked + * in order. + * + * @param condition a function that should return `true` if the conversion should be applied from the given `fromType` + * to the given `toSchema`. + * @param converter a function that performs the conversion with access to a [ConverterScope]. + */ + public fun convertIf( + condition: (fromType: KType, toSchema: ColumnSchema) -> Boolean, + converter: ConverterScope.(Any?) -> Any?, + ) +} + +/** + * Defines how to fill specified columns in destination schema that were not found in original dataframe. + * All [fill] operations for missing columns are executed after successful conversion of matched columns, so converted values of matched columns can be safely used in [with] expression. + * @param columns target columns in destination dataframe schema to be filled + */ +public inline fun ConvertSchemaDsl.fill( + noinline columns: ColumnsSelector, +): ConvertToFill = ConvertToFill(this, columns) + +public fun ConvertToFill.with(expr: RowExpression) { + (dsl as ConvertSchemaDslInternal).fill(columns as ColumnsSelector<*, C>, expr as RowExpression<*, C>) +} + +/** + * Defines how to convert `String` values into given type [C]. + */ +public inline fun ConvertSchemaDsl<*>.parser(noinline parser: (String) -> C): Unit = + convert().with(parser) + +/** + * Defines how to convert values of given type [C] + */ +public inline fun ConvertSchemaDsl<*>.convert(): ConvertType = ConvertType(this, typeOf()) + +/** + * Defines how to convert values of type [C] into type [R] + */ +public inline fun ConvertType.with(noinline converter: (C) -> R): Unit = + dsl.convert(from, typeOf(), converter) + +public class ConvertType( + @PublishedApi internal val dsl: ConvertSchemaDsl<*>, + @PublishedApi internal val from: KType, + internal val property: KProperty? = null, +) + +// region DataFrame + +/** + * Converts values in [DataFrame] to match given column schema [T]. + * + * Original columns are mapped to destination columns by column [path][DataColumn.path]. + * + * Type converters for every column are selected automatically. See [convert] operation for details. + * + * To specify custom type converters for the particular types use [ConvertSchemaDsl]. + * + * Example of Dsl: + * ```kotlin + * df.convertTo { + * // defines how to convert Int? -> String + * convert().with { it?.toString() ?: "No input given" } + * // defines how to convert String -> SomeType + * parser { SomeType(it) } + * // fill missing column `sum` with expression `a + b` + * fill { sum }.with { a + b } + * } + * ``` + * + * @param [T] class that defines target schema for conversion. + * @param [excessiveColumnsBehavior] how to handle excessive columns in the original [DataFrame]. + * @param [body] optional dsl to define custom type converters. + * @throws [ColumnNotFoundException] if [DataFrame] doesn't contain columns that are required by destination schema. + * @throws [ExcessiveColumnsException] if [DataFrame] contains columns that are not required by destination schema and [excessiveColumnsBehavior] is set to [ExcessiveColumns.Fail]. + * @throws [TypeConverterNotFoundException] if suitable type converter for some column was not found. + * @throws [TypeConversionException] if type converter failed to convert column values. + * @return converted [DataFrame]. + */ +public inline fun AnyFrame.convertTo( + excessiveColumnsBehavior: ExcessiveColumns = ExcessiveColumns.Keep, + noinline body: ConvertSchemaDsl.() -> Unit = {}, +): DataFrame = convertToImpl(typeOf(), true, excessiveColumnsBehavior, body).cast() + +/** + * Converts values in [DataFrame] to match given column schema [T]. + * + * Original columns are mapped to destination columns by column [path][DataColumn.path]. + * + * Type converters for every column are selected automatically. See [convert] operation for details. + * + * To specify custom type converters for the particular types use [ConvertSchemaDsl]. + * + * Example of Dsl: + * ```kotlin + * df.convertTo(schemaFrom = sample) { + * // defines how to convert Int? -> String + * convert().with { it?.toString() ?: "No input given" } + * // defines how to convert String -> SomeType + * parser { SomeType(it) } + * // fill missing column `sum` with expression `a + b` + * fill { sum }.with { a + b } + * } + * ``` + * + * @param [T] class that defines target schema for conversion. + * @param [schemaFrom] dataframe which type [T] will be used. + * @param [excessiveColumnsBehavior] how to handle excessive columns in the original [DataFrame]. + * @param [body] optional dsl to define custom type converters. + * @throws [ColumnNotFoundException] if [DataFrame] doesn't contain columns that are required by destination schema. + * @throws [ExcessiveColumnsException] if [DataFrame] contains columns that are not required by destination schema and [excessiveColumnsBehavior] is set to [ExcessiveColumns.Fail]. + * @throws [TypeConverterNotFoundException] if suitable type converter for some column was not found. + * @throws [TypeConversionException] if type converter failed to convert column values. + * @return converted [DataFrame]. + */ +public inline fun AnyFrame.convertTo( + @Suppress("UNUSED_PARAMETER") schemaFrom: DataFrame, + excessiveColumnsBehavior: ExcessiveColumns = ExcessiveColumns.Keep, + noinline body: ConvertSchemaDsl.() -> Unit = {}, +): DataFrame = convertToImpl(typeOf(), true, excessiveColumnsBehavior, body).cast() + +/** + * Converts values in [DataFrame] to match given column schema [schemaType]. + * + * Original columns are mapped to destination columns by column [path][DataColumn.path]. + * + * Type converters for every column are selected automatically. See [convert] operation for details. + * + * To specify custom type converters for the particular types use [ConvertSchemaDsl]. + * + * Example of Dsl: + * ```kotlin + * df.convertTo { + * // defines how to convert Int? -> String + * convert().with { it?.toString() ?: "No input given" } + * // defines how to convert String -> SomeType + * parser { SomeType(it) } + * // fill missing column `sum` with expression `a+b` + * fill { sum }.with { a + b } + * } + * ``` + * + * @param [schemaType] defines target schema for conversion. + * @param [excessiveColumnsBehavior] how to handle excessive columns in the original [DataFrame]. + * @param [body] optional dsl to define custom type converters. + * @throws [ColumnNotFoundException] if [DataFrame] doesn't contain columns that are required by destination schema. + * @throws [ExcessiveColumnsException] if [DataFrame] contains columns that are not required by destination schema and [excessiveColumnsBehavior] is set to [ExcessiveColumns.Fail]. + * @throws [TypeConverterNotFoundException] if suitable type converter for some column was not found. + * @throws [TypeConversionException] if type converter failed to convert column values. + * @return converted [DataFrame]. + */ +public fun AnyFrame.convertTo( + schemaType: KType, + excessiveColumnsBehavior: ExcessiveColumns = ExcessiveColumns.Keep, + body: ConvertSchemaDsl.() -> Unit = {}, +): AnyFrame = convertToImpl(schemaType, true, excessiveColumnsBehavior, body) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/copy.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/copy.kt new file mode 100644 index 000000000..c0c930a03 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/copy.kt @@ -0,0 +1,9 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame + +// region DataFrame + +public fun DataFrame.copy(): DataFrame = columns().toDataFrame().cast() + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/corr.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/corr.kt new file mode 100644 index 000000000..ef84168c9 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/corr.kt @@ -0,0 +1,40 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.corrImpl +import kotlin.reflect.KProperty +import kotlin.reflect.typeOf + +internal fun AnyCol.isSuitableForCorr() = isSubtypeOf() || type() == typeOf() + +// region DataFrame + +public data class Corr(internal val df: DataFrame, internal val columns: ColumnsSelector) + +public fun DataFrame.corr(): DataFrame = corr { colsAtAnyDepth { it.isSuitableForCorr() } }.withItself() + +public fun DataFrame.corr(columns: ColumnsSelector): Corr = Corr(this, columns) + +public fun DataFrame.corr(vararg columns: String): Corr = corr { columns.toColumnSet() } + +public fun DataFrame.corr(vararg columns: KProperty): Corr = corr { columns.toColumnSet() } + +public fun DataFrame.corr(vararg columns: ColumnReference): Corr = corr { columns.toColumnSet() } + +public fun Corr.with(otherColumns: ColumnsSelector): DataFrame = corrImpl(otherColumns) + +public fun Corr.with(vararg otherColumns: String): DataFrame = with { otherColumns.toColumnSet() } + +public fun Corr.with(vararg otherColumns: KProperty): DataFrame = + with { otherColumns.toColumnSet() } + +public fun Corr.with(vararg otherColumns: ColumnReference): DataFrame = + with { otherColumns.toColumnSet() } + +public fun Corr.withItself(): DataFrame = with(columns) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/count.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/count.kt new file mode 100644 index 000000000..e8b306338 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/count.kt @@ -0,0 +1,62 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Predicate +import org.jetbrains.kotlinx.dataframe.RowFilter +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateValue + +// region DataColumn + +public fun DataColumn.count(predicate: Predicate? = null): Int = + if (predicate == null) { + size() + } else { + values().count(predicate) + } + +// endregion + +// region DataRow + +public fun AnyRow.count(): Int = columnsCount() + +public fun AnyRow.count(predicate: Predicate): Int = values().count(predicate) + +// endregion + +// region DataFrame + +public fun DataFrame.count(): Int = rowsCount() + +public fun DataFrame.count(predicate: RowFilter): Int = rows().count { predicate(it, it) } + +// endregion + +// region GroupBy + +public fun Grouped.count(resultName: String = "count"): DataFrame = + aggregateValue(resultName) { count() default 0 } + +public fun Grouped.count(resultName: String = "count", predicate: RowFilter): DataFrame = + aggregateValue(resultName) { count(predicate) default 0 } + +// endregion + +// region Pivot + +public fun Pivot.count(): DataRow = delegate { count() } + +public fun Pivot.count(predicate: RowFilter): DataRow = delegate { count(predicate) } + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.count(): DataFrame = aggregate { count() default 0 } + +public fun PivotGroupBy.count(predicate: RowFilter): DataFrame = aggregate { count(predicate) default 0 } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/countDistinct.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/countDistinct.kt new file mode 100644 index 000000000..679d21dd1 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/countDistinct.kt @@ -0,0 +1,28 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.indices +import kotlin.reflect.KProperty + +// region DataFrame + +public fun AnyFrame.countDistinct(): Int = countDistinct { all() } + +public fun DataFrame.countDistinct(columns: ColumnsSelector): Int { + val cols = get(columns) + return indices.distinctBy { i -> cols.map { it[i] } }.size +} + +public fun DataFrame.countDistinct(vararg columns: String): Int = countDistinct { columns.toColumnSet() } + +public fun DataFrame.countDistinct(vararg columns: KProperty): Int = + countDistinct { columns.toColumnSet() } + +public fun DataFrame.countDistinct(vararg columns: AnyColumnReference): Int = + countDistinct { columns.toColumnSet() } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cumSum.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cumSum.kt new file mode 100644 index 000000000..9d8c7ff71 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cumSum.kt @@ -0,0 +1,88 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.math.cumSum +import org.jetbrains.kotlinx.dataframe.math.defaultCumSumSkipNA +import org.jetbrains.kotlinx.dataframe.typeClass +import java.math.BigDecimal +import kotlin.reflect.KProperty +import kotlin.reflect.typeOf + +// region DataColumn + +public fun DataColumn.cumSum(skipNA: Boolean = defaultCumSumSkipNA): DataColumn = + when (type()) { + typeOf() -> cast().cumSum(skipNA).cast() + typeOf() -> cast().cumSum(skipNA).cast() + typeOf() -> cast().cumSum(skipNA).cast() + typeOf() -> cast().cumSum(skipNA).cast() + typeOf() -> cast().cumSum().cast() + typeOf() -> cast().cumSum(skipNA).cast() + typeOf() -> cast().cumSum().cast() + typeOf() -> cast().cumSum(skipNA).cast() + typeOf() -> cast().cumSum().cast() + typeOf() -> cast().cumSum(skipNA).cast() + typeOf(), typeOf() -> convertToDouble().cumSum(skipNA).cast() + else -> error("Cumsum for type ${type()} is not supported") + } + +private val supportedClasses = setOf(Double::class, Float::class, Int::class, Long::class, BigDecimal::class) + +// endregion + +// region DataFrame + +public fun DataFrame.cumSum( + skipNA: Boolean = defaultCumSumSkipNA, + columns: ColumnsSelector, +): DataFrame = + convert(columns).to { if (it.typeClass in supportedClasses) it.cast().cumSum(skipNA) else it } + +public fun DataFrame.cumSum(vararg columns: String, skipNA: Boolean = defaultCumSumSkipNA): DataFrame = + cumSum(skipNA) { columns.toColumnSet() } + +public fun DataFrame.cumSum( + vararg columns: AnyColumnReference, + skipNA: Boolean = defaultCumSumSkipNA, +): DataFrame = cumSum(skipNA) { columns.toColumnSet() } + +public fun DataFrame.cumSum(vararg columns: KProperty<*>, skipNA: Boolean = defaultCumSumSkipNA): DataFrame = + cumSum(skipNA) { columns.toColumnSet() } + +public fun DataFrame.cumSum(skipNA: Boolean = defaultCumSumSkipNA): DataFrame = + cumSum(skipNA) { + colsAtAnyDepth { !it.isColumnGroup() } + } + +// endregion + +// region GroupBy + +public fun GroupBy.cumSum( + skipNA: Boolean = defaultCumSumSkipNA, + columns: ColumnsSelector, +): GroupBy = updateGroups { cumSum(skipNA, columns) } + +public fun GroupBy.cumSum(vararg columns: String, skipNA: Boolean = defaultCumSumSkipNA): GroupBy = + cumSum(skipNA) { columns.toColumnSet() } + +public fun GroupBy.cumSum( + vararg columns: AnyColumnReference, + skipNA: Boolean = defaultCumSumSkipNA, +): GroupBy = cumSum(skipNA) { columns.toColumnSet() } + +public fun GroupBy.cumSum( + vararg columns: KProperty<*>, + skipNA: Boolean = defaultCumSumSkipNA, +): GroupBy = cumSum(skipNA) { columns.toColumnSet() } + +public fun GroupBy.cumSum(skipNA: Boolean = defaultCumSumSkipNA): GroupBy = + cumSum(skipNA) { + colsAtAnyDepth { !it.isColumnGroup() } + } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/describe.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/describe.kt new file mode 100644 index 000000000..66b51c588 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/describe.kt @@ -0,0 +1,59 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.DataSchema +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.describeImpl +import kotlin.reflect.KProperty +import kotlin.reflect.KType + +// region DataSchema +@DataSchema +public interface ColumnDescription { + public val name: String + public val path: ColumnPath + public val type: KType + public val count: Int + public val unique: Int + public val nulls: Int + public val top: Any + public val freq: Int + public val mean: Double + public val std: Double + public val min: Any + public val median: Any + public val max: Any +} + +// endregion + +// region DataColumn + +public fun DataColumn.describe(): DataFrame = describeImpl(listOf(this)) + +// endregion + +// region DataFrame + +public fun DataFrame.describe(): DataFrame = + describe { + colsAtAnyDepth { !it.isColumnGroup() } + } + +public fun DataFrame.describe(columns: ColumnsSelector): DataFrame = + describeImpl(getColumnsWithPaths(columns)) + +public fun DataFrame.describe(vararg columns: String): DataFrame = + describe { columns.toColumnSet() } + +public fun DataFrame.describe(vararg columns: ColumnReference): DataFrame = + describe { columns.toColumnSet() } + +public fun DataFrame.describe(vararg columns: KProperty): DataFrame = + describe { columns.toColumnSet() } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/digitize.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/digitize.kt new file mode 100644 index 000000000..da118b323 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/digitize.kt @@ -0,0 +1,39 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import kotlin.reflect.KClass + +// region DataColumn + +public fun DataColumn.digitize(vararg bins: Int, right: Boolean = false): DataColumn = + digitize(bins.toList(), Double::class, right) + +public fun > DataColumn.digitize(vararg bins: T, right: Boolean = false): DataColumn = + digitize(bins.toList(), right) + +public fun > DataColumn.digitize( + bins: List, + kclass: KClass, + right: Boolean = false, +): DataColumn = + digitize( + bins = bins.toList().map { org.jetbrains.kotlinx.dataframe.impl.convert(it, kclass) }, + right = right, + ) + +public fun > DataColumn.digitize(bins: List, right: Boolean = false): DataColumn { + // TODO: use binary search + // TODO: support descending order of bins + val predicate: (T, T) -> Boolean = if (right) { value, bin -> value <= bin } else { value, bin -> value < bin } + + return map { value -> + val index = bins.indexOfFirst { predicate(value, it) } + if (index == -1) { + bins.size + } else { + index + } + } +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/distinct.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/distinct.kt new file mode 100644 index 000000000..a3b5aa625 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/distinct.kt @@ -0,0 +1,124 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.api.DistinctColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.exceptions.DuplicateColumnNamesException +import org.jetbrains.kotlinx.dataframe.impl.columns.DistinctColumnSet +import org.jetbrains.kotlinx.dataframe.indices +import kotlin.reflect.KProperty + +// region DataFrame + +public fun DataFrame.distinct(): DataFrame = distinctBy { all() } + +public fun DataFrame.distinct(columns: ColumnsSelector): DataFrame = select(columns).distinct() + +public fun DataFrame.distinct(vararg columns: KProperty<*>): DataFrame = + distinct { + val set = columns.toColumnSet() + set + } + +public fun DataFrame.distinct(vararg columns: String): DataFrame = distinct { columns.toColumnSet() } + +public fun DataFrame.distinct(vararg columns: AnyColumnReference): DataFrame = + distinct { columns.toColumnSet() } + +public fun DataFrame.distinctBy(vararg columns: KProperty<*>): DataFrame = + distinctBy { columns.toColumnSet() } + +public fun DataFrame.distinctBy(vararg columns: String): DataFrame = distinctBy { columns.toColumnSet() } + +public fun DataFrame.distinctBy(vararg columns: AnyColumnReference): DataFrame = + distinctBy { columns.toColumnSet() } + +public fun DataFrame.distinctBy(columns: ColumnsSelector): DataFrame { + val cols = get(columns) + val distinctIndices = indices.distinctBy { i -> cols.map { it[i] } } + return this[distinctIndices] +} + +// endregion + +// region ColumnsSelectionDsl + +/** + * ## Distinct [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface DistinctColumnsSelectionDsl { + + /** + * ## Distinct Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + * + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`distinct`**][org.jetbrains.kotlinx.dataframe.api.DistinctColumnsSelectionDsl.distinct]**`()`** + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** __`.`__[**`distinct`**][ColumnsSelectionDsl.distinct] */ + public interface ColumnSetName + } + + /** + * ## Distinct + * Returns a new [ColumnSet] from [this] [ColumnSet] containing only distinct columns (by path). + * This is useful when you've selected the same column multiple times but only want it once. + * + * NOTE: This doesn't solve [DuplicateColumnNamesException] if you've selected two columns with the same name. + * For this, you'll need to [rename][ColumnsSelectionDsl.named] one of the columns. + * + * ### Check out: [Grammar] + * + * #### For Example: + * `df.`[select][DataFrame.select]` { (`[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>() `[and][ColumnsSelectionDsl.and]` age).`[distinct][ColumnSet.distinct]`() }` + * + * `df.`[select][DataFrame.select]` { `[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]`().`[nameStartsWith][ColumnsSelectionDsl.nameStartsWith]`("order").`[distinct][ColumnSet.distinct]`() }` + * + * @return A new [ColumnSet] containing only distinct columns (by path). + * @see ColumnsSelectionDsl.named + * @see ColumnsSelectionDsl.simplify + */ + public fun ColumnSet.distinct(): ColumnSet = DistinctColumnSet(this) +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/drop.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/drop.kt new file mode 100644 index 000000000..747b41eb3 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/drop.kt @@ -0,0 +1,1097 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Predicate +import org.jetbrains.kotlinx.dataframe.RowFilter +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.size +import org.jetbrains.kotlinx.dataframe.impl.columns.transform +import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle +import org.jetbrains.kotlinx.dataframe.index +import org.jetbrains.kotlinx.dataframe.nrow +import kotlin.reflect.KProperty + +// region DataColumn + +public fun DataColumn.drop(predicate: Predicate): DataColumn = filter { !predicate(it) } + +public fun DataColumn.drop(n: Int): DataColumn = + when { + n == 0 -> this + n >= size -> get(emptyList()) + else -> get(n until size) + } + +public fun DataColumn.dropLast(n: Int = 1): DataColumn = take(size - n) + +// endregion + +// region DataFrame + +/** + * Returns a DataFrame containing all rows except first [n] rows. + * + * @throws IllegalArgumentException if [n] is negative. + */ +public fun DataFrame.drop(n: Int): DataFrame { + require(n >= 0) { "Requested rows count $n is less than zero." } + return getRows(n.coerceAtMost(nrow) until nrow) +} + +/** + * Returns a DataFrame containing all rows except last [n] rows. + * + * @throws IllegalArgumentException if [n] is negative. + */ +public fun DataFrame.dropLast(n: Int = 1): DataFrame { + require(n >= 0) { "Requested rows count $n is less than zero." } + return take((nrow - n).coerceAtLeast(0)) +} + +/** + * Returns a DataFrame containing all rows except rows that satisfy the given [predicate]. + */ +public fun DataFrame.drop(predicate: RowFilter): DataFrame = filter { !predicate(it, it) } + +/** + * Returns a DataFrame containing all rows except first rows that satisfy the given [predicate]. + */ +public fun DataFrame.dropWhile(predicate: RowFilter): DataFrame = + firstOrNull { !predicate(it, it) }?.let { drop(it.index) } ?: this + +// endregion + +// region ColumnsSelectionDsl + +/** + * ## Drop [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface DropColumnsSelectionDsl { + + /** + * ## Drop (Last) (Cols) (While) Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * `number: `[`Int`][Int] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`drop`**][ColumnsSelectionDsl.drop]`(`[**`Last`**][ColumnsSelectionDsl.dropLast]`)`**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + * `| `[**`drop`**][ColumnsSelectionDsl.dropWhile]`(`[**`Last`**][ColumnsSelectionDsl.dropLastWhile]`)`[**`While`**][ColumnsSelectionDsl.dropWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`drop`**][ColumnsSelectionDsl.drop]`(`[**`Last`**][ColumnSet.dropLast]`)`**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + *     `| `__`.`__[**`drop`**][ColumnsSelectionDsl.dropWhile]`(`[**`Last`**][ColumnsSelectionDsl.dropLastWhile]`)`[**`While`**][ColumnsSelectionDsl.dropWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`drop`**][ColumnsSelectionDsl.dropCols]`(`[**`Last`**][ColumnsSelectionDsl.dropLastCols]`)`[**`Cols`**][ColumnsSelectionDsl.dropCols]**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + *     `| `__`.`__[**`drop`**][ColumnsSelectionDsl.dropColsWhile]`(`[**`Last`**][ColumnsSelectionDsl.dropLastColsWhile]`)`[**`ColsWhile`**][ColumnsSelectionDsl.dropColsWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`drop`**][ColumnsSelectionDsl.drop]`(`[**`Last`**][ColumnsSelectionDsl.dropLast]`)` */ + public interface PlainDslName + + /** __`.`__[**`drop`**][ColumnsSelectionDsl.drop]`(`[**`Last`**][ColumnSet.dropLast]`)` */ + public interface ColumnSetName + + /** __`.`__[**`drop`**][ColumnsSelectionDsl.dropCols]`(`[**`Last`**][ColumnsSelectionDsl.dropLastCols]`)`[**`Cols`**][ColumnsSelectionDsl.dropCols] */ + public interface ColumnGroupName + + /** [**`drop`**][ColumnsSelectionDsl.dropWhile]`(`[**`Last`**][ColumnsSelectionDsl.dropLastWhile]`)`[**`While`**][ColumnsSelectionDsl.dropWhile] */ + public interface PlainDslWhileName + + /** __`.`__[**`drop`**][ColumnsSelectionDsl.dropWhile]`(`[**`Last`**][ColumnsSelectionDsl.dropLastWhile]`)`[**`While`**][ColumnsSelectionDsl.dropWhile] */ + public interface ColumnSetWhileName + + /** __`.`__[**`drop`**][ColumnsSelectionDsl.dropColsWhile]`(`[**`Last`**][ColumnsSelectionDsl.dropLastColsWhile]`)`[**`ColsWhile`**][ColumnsSelectionDsl.dropColsWhile] */ + public interface ColumnGroupWhileName + } + + // region drop + + /** + * ## Drop (Cols) + * This drops the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `drop` is called `dropCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[drop][ColumnSet.drop]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[drop][ColumnsSelectionDsl.drop]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropCols][SingleColumn.dropCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropCols][String.dropCols]`(3) }` + * + * #### Examples for this overload: + * + * + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + private interface CommonDropFirstDocs + + /** + * ## Drop (Cols) + * This drops the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `drop` is called `dropCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[drop][ColumnSet.drop]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[drop][ColumnsSelectionDsl.drop]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropCols][SingleColumn.dropCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropCols][String.dropCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[drop][ColumnSet.drop]`(2) }` + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[drop][ColumnSet.drop]`(2) }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun ColumnSet.drop(n: Int): ColumnSet = transform { it.drop(n) } + + /** + * ## Drop (Cols) + * This drops the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `drop` is called `dropCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[drop][ColumnSet.drop]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[drop][ColumnsSelectionDsl.drop]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropCols][SingleColumn.dropCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropCols][String.dropCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[drop][ColumnsSelectionDsl.drop]`(5) }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun ColumnsSelectionDsl<*>.drop(n: Int): ColumnSet<*> = asSingleColumn().dropCols(n) + + /** + * ## Drop (Cols) + * This drops the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `drop` is called `dropCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[drop][ColumnSet.drop]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[drop][ColumnsSelectionDsl.drop]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropCols][SingleColumn.dropCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropCols][String.dropCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[dropCols][SingleColumn.dropCols]`(1) }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun SingleColumn>.dropCols(n: Int): ColumnSet<*> = + this.ensureIsColumnGroup().transformSingle { it.cols().drop(n) } + + /** + * ## Drop (Cols) + * This drops the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `drop` is called `dropCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[drop][ColumnSet.drop]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[drop][ColumnsSelectionDsl.drop]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropCols][SingleColumn.dropCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropCols][String.dropCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[dropCols][String.dropCols]`(1) }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun String.dropCols(n: Int): ColumnSet<*> = columnGroup(this).dropCols(n) + + /** + * ## Drop (Cols) + * This drops the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `drop` is called `dropCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[drop][ColumnSet.drop]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[drop][ColumnsSelectionDsl.drop]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropCols][SingleColumn.dropCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropCols][String.dropCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[dropCols][KProperty.dropCols]`(1) }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun KProperty<*>.dropCols(n: Int): ColumnSet<*> = columnGroup(this).dropCols(n) + + /** + * ## Drop (Cols) + * This drops the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `drop` is called `dropCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[drop][ColumnSet.drop]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[drop][ColumnsSelectionDsl.drop]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropCols][SingleColumn.dropCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropCols][String.dropCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[dropCols][ColumnPath.dropCols]`(1) }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun ColumnPath.dropCols(n: Int): ColumnSet<*> = columnGroup(this).dropCols(n) + + // endregion + + // region dropLast + + /** + * ## Drop Last (Cols) + * This drops the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLast` is called `dropLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[dropLast][ColumnSet.dropLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[dropLast][ColumnsSelectionDsl.dropLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropLastCols][SingleColumn.dropLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropLastCols][String.dropLastCols]`(3) }` + * + * #### Examples for this overload: + * + * + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + private interface CommonDropLastDocs + + /** + * ## Drop Last (Cols) + * This drops the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLast` is called `dropLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[dropLast][ColumnSet.dropLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[dropLast][ColumnsSelectionDsl.dropLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropLastCols][SingleColumn.dropLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropLastCols][String.dropLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[dropLast][ColumnSet.dropLast]`(2) }` + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[dropLast][ColumnSet.dropLast]`() }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun ColumnSet.dropLast(n: Int = 1): ColumnSet = transform { it.dropLast(n) } + + /** + * ## Drop Last (Cols) + * This drops the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLast` is called `dropLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[dropLast][ColumnSet.dropLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[dropLast][ColumnsSelectionDsl.dropLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropLastCols][SingleColumn.dropLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropLastCols][String.dropLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[dropLast][ColumnsSelectionDsl.dropLast]`(5) }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun ColumnsSelectionDsl<*>.dropLast(n: Int = 1): ColumnSet<*> = this.asSingleColumn().dropLastCols(n) + + /** + * ## Drop Last (Cols) + * This drops the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLast` is called `dropLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[dropLast][ColumnSet.dropLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[dropLast][ColumnsSelectionDsl.dropLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropLastCols][SingleColumn.dropLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropLastCols][String.dropLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[dropLastCols][SingleColumn.dropLastCols]`() }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun SingleColumn>.dropLastCols(n: Int): ColumnSet<*> = + this.ensureIsColumnGroup().transformSingle { it.cols().dropLast(n) } + + /** + * ## Drop Last (Cols) + * This drops the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLast` is called `dropLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[dropLast][ColumnSet.dropLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[dropLast][ColumnsSelectionDsl.dropLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropLastCols][SingleColumn.dropLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropLastCols][String.dropLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[dropLastCols][String.dropLastCols]`(1) }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun String.dropLastCols(n: Int): ColumnSet<*> = columnGroup(this).dropLastCols(n) + + /** + * ## Drop Last (Cols) + * This drops the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLast` is called `dropLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[dropLast][ColumnSet.dropLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[dropLast][ColumnsSelectionDsl.dropLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropLastCols][SingleColumn.dropLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropLastCols][String.dropLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[dropLastCols][KProperty.dropLastCols]`(1) }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun KProperty<*>.dropLastCols(n: Int): ColumnSet<*> = columnGroup(this).dropLastCols(n) + + /** + * ## Drop Last (Cols) + * This drops the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLast` is called `dropLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[dropLast][ColumnSet.dropLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[dropLast][ColumnsSelectionDsl.dropLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[dropLastCols][SingleColumn.dropLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[dropLastCols][String.dropLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[dropLastCols][ColumnPath.dropLastCols]`(1) }` + * + * @param [n] The number of columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun ColumnPath.dropLastCols(n: Int): ColumnSet<*> = columnGroup(this).dropLastCols(n) + + // endregion + + // region dropWhile + + /** + * ## Drop (Cols) While + * This function drops the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropWhile` is called + * `dropColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropWhile`][ColumnSet.dropWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropWhile`][SingleColumn.dropColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropColsWhile`][String.dropColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + private interface CommonDropWhileDocs + + /** + * ## Drop (Cols) While + * This function drops the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropWhile` is called + * `dropColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropWhile`][ColumnSet.dropWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropWhile`][SingleColumn.dropColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropColsWhile`][String.dropColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[dropWhile][ColumnSet.dropWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[dropWhile][ColumnSet.dropWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun ColumnSet.dropWhile(predicate: ColumnFilter): ColumnSet = + transform { it.dropWhile(predicate) } + + /** + * ## Drop (Cols) While + * This function drops the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropWhile` is called + * `dropColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropWhile`][ColumnSet.dropWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropWhile`][SingleColumn.dropColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropColsWhile`][String.dropColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[dropWhile][ColumnsSelectionDsl.dropWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun ColumnsSelectionDsl<*>.dropWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + this.asSingleColumn().dropColsWhile(predicate) + + /** + * ## Drop (Cols) While + * This function drops the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropWhile` is called + * `dropColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropWhile`][ColumnSet.dropWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropWhile`][SingleColumn.dropColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropColsWhile`][String.dropColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[dropColsWhile][SingleColumn.dropColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun SingleColumn>.dropColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + this.ensureIsColumnGroup().transformSingle { it.cols().dropWhile(predicate) } + + /** + * ## Drop (Cols) While + * This function drops the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropWhile` is called + * `dropColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropWhile`][ColumnSet.dropWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropWhile`][SingleColumn.dropColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropColsWhile`][String.dropColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[dropColsWhile][String.dropColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun String.dropColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).dropColsWhile(predicate) + + /** + * ## Drop (Cols) While + * This function drops the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropWhile` is called + * `dropColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropWhile`][ColumnSet.dropWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropWhile`][SingleColumn.dropColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropColsWhile`][String.dropColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[dropColsWhile][KProperty.dropColsWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun KProperty<*>.dropColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).dropColsWhile(predicate) + + /** + * ## Drop (Cols) While + * This function drops the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropWhile` is called + * `dropColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropWhile`][ColumnSet.dropWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropWhile`][SingleColumn.dropColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropColsWhile`][String.dropColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[dropColsWhile][ColumnPath.dropColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun ColumnPath.dropColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).dropColsWhile(predicate) + + // endregion + + // region dropLastWhile + + /** + * ## Drop Last (Cols) While + * This function drops the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLastWhile` is called + * `dropLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropLastWhile`][ColumnSet.dropLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropLastWhile`][SingleColumn.dropLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropLastColsWhile`][String.dropLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + private interface CommonDropLastWhileDocs + + /** + * ## Drop Last (Cols) While + * This function drops the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLastWhile` is called + * `dropLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropLastWhile`][ColumnSet.dropLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropLastWhile`][SingleColumn.dropLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropLastColsWhile`][String.dropLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[dropLastWhile][ColumnSet.dropLastWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[dropLastWhile][ColumnSet.dropLastWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun ColumnSet.dropLastWhile(predicate: ColumnFilter): ColumnSet = + transform { it.dropLastWhile(predicate) } + + /** + * ## Drop Last (Cols) While + * This function drops the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLastWhile` is called + * `dropLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropLastWhile`][ColumnSet.dropLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropLastWhile`][SingleColumn.dropLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropLastColsWhile`][String.dropLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[dropLastWhile][ColumnsSelectionDsl.dropLastWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun ColumnsSelectionDsl<*>.dropLastWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + this.asSingleColumn().dropLastColsWhile(predicate) + + /** + * ## Drop Last (Cols) While + * This function drops the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLastWhile` is called + * `dropLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropLastWhile`][ColumnSet.dropLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropLastWhile`][SingleColumn.dropLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropLastColsWhile`][String.dropLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[dropLastColsWhile][SingleColumn.dropLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun SingleColumn>.dropLastColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + this.ensureIsColumnGroup().transformSingle { it.cols().dropLastWhile(predicate) } + + /** + * ## Drop Last (Cols) While + * This function drops the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLastWhile` is called + * `dropLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropLastWhile`][ColumnSet.dropLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropLastWhile`][SingleColumn.dropLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropLastColsWhile`][String.dropLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[dropLastColsWhile][String.dropLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun String.dropLastColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).dropLastColsWhile(predicate) + + /** + * ## Drop Last (Cols) While + * This function drops the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLastWhile` is called + * `dropLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropLastWhile`][ColumnSet.dropLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropLastWhile`][SingleColumn.dropLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropLastColsWhile`][String.dropLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[dropLastColsWhile][SingleColumn.dropLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[dropLastColsWhile][KProperty.dropLastColsWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun KProperty<*>.dropLastColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).dropLastColsWhile(predicate) + + /** + * ## Drop Last (Cols) While + * This function drops the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `dropLastWhile` is called + * `dropLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`dropLastWhile`][ColumnSet.dropLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`dropLastWhile`][SingleColumn.dropLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`dropLastColsWhile`][String.dropLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[dropLastColsWhile][ColumnPath.dropLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to drop. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun ColumnPath.dropLastColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).dropLastColsWhile(predicate) + + // endregion +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/duplicate.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/duplicate.kt new file mode 100644 index 000000000..4727b9602 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/duplicate.kt @@ -0,0 +1,17 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowFilter +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.impl.api.duplicateImpl +import org.jetbrains.kotlinx.dataframe.impl.api.duplicateRowsImpl + +public fun DataFrame.duplicate(n: Int): FrameColumn = List(n) { this }.toFrameColumn() + +public fun DataFrame.duplicateRows(n: Int): DataFrame = duplicateRowsImpl(n) + +public fun DataFrame.duplicateRows(n: Int, filter: RowFilter): DataFrame = + duplicateRowsImpl(n, rows().filter { filter(it, it) }.map { it.index() }) + +public fun DataRow.duplicate(n: Int): DataFrame = duplicateImpl(n) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/enum.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/enum.kt new file mode 100644 index 000000000..76fbe6ca7 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/enum.kt @@ -0,0 +1,11 @@ +package org.jetbrains.kotlinx.dataframe.api + +/** + * Make your enum class inherit [DataSchemaEnum] to + * make String -> Enum and Enum -> String conversions work + * using [value] instead of the enum name. + * (Fallback to enum name if the value cannot be found is implemented) + */ +public interface DataSchemaEnum { + public val value: String +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/explode.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/explode.kt new file mode 100644 index 000000000..926b8a723 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/explode.kt @@ -0,0 +1,62 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.explodeImpl +import kotlin.reflect.KProperty + +private val defaultExplodeColumns: ColumnsSelector<*, *> = { colsAtAnyDepth { it.isList() || it.isFrameColumn() } } + +// region explode DataFrame +@Refine +@Interpretable("Explode0") +public fun DataFrame.explode( + dropEmpty: Boolean = true, + selector: ColumnsSelector = defaultExplodeColumns, +): DataFrame = explodeImpl(dropEmpty, selector) + +public fun DataFrame.explode(vararg columns: String, dropEmpty: Boolean = true): DataFrame = + explode(dropEmpty) { columns.toColumnSet() } + +public fun DataFrame.explode(vararg columns: ColumnReference, dropEmpty: Boolean = true): DataFrame = + explode(dropEmpty) { columns.toColumnSet() } + +public fun DataFrame.explode(vararg columns: KProperty, dropEmpty: Boolean = true): DataFrame = + explode(dropEmpty) { columns.toColumnSet() } + +// endregion + +// region explode DataRow + +public fun DataRow.explode( + dropEmpty: Boolean = true, + selector: ColumnsSelector = defaultExplodeColumns, +): DataFrame = toDataFrame().explode(dropEmpty, selector) + +public fun DataRow.explode(vararg columns: String, dropEmpty: Boolean = true): DataFrame = + explode(dropEmpty) { columns.toColumnSet() } + +public fun DataRow.explode(vararg columns: ColumnReference, dropEmpty: Boolean = true): DataFrame = + explode(dropEmpty) { columns.toColumnSet() } + +public fun DataRow.explode(vararg columns: KProperty, dropEmpty: Boolean = true): DataFrame = + explode(dropEmpty) { columns.toColumnSet() } + +// endregion + +// region explode DataColumn + +@JvmName("explodeList") +public fun DataColumn>.explode(): DataColumn = explodeImpl() as DataColumn + +@JvmName("explodeFrames") +public fun DataColumn>.explode(): ColumnGroup = concat().asColumnGroup(name()) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/expr.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/expr.kt new file mode 100644 index 000000000..6c26342a4 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/expr.kt @@ -0,0 +1,99 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsContainer +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.api.ExprColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.documentation.ColumnExpression + +// region ColumnsSelectionDsl + +/** + * ## Expr [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface ExprColumnsSelectionDsl { + + /** + * ## Expr Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `name: `[`String`][String] + * + *      + * + * `infer: `[`Infer`][org.jetbrains.kotlinx.dataframe.api.Infer] + * + *      + * + * `expression: `[Column Expression][org.jetbrains.kotlinx.dataframe.documentation.ColumnExpression] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`expr`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]**`(`**`[`[`name`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NameDef]**`,`**`][`[`infer`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.InferDef]`]`**`) { `**[`expression`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnExpressionDef]**` }`** + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`expr`**][ColumnsSelectionDsl.expr] */ + public interface PlainDslName + } +} + +/** + * ## Column Expression + * Create a temporary new column by defining an expression to fill up each row. + * + * See [Column Expression][org.jetbrains.kotlinx.dataframe.documentation.ColumnExpression] for more information. + * + * This function is essentially a shortcut for [ColumnsContainer.mapToColumn]. + * + * ### Check out: [Usage][ExprColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[groupBy][DataFrame.groupBy]` { `[`expr`][ColumnsSelectionDsl.expr]` { firstName.`[`length`][String.length]` + lastName.`[`length`][String.length]` } `[`named`][named]` "nameLength" }` + * + * `df.`[sortBy][DataFrame.sortBy]` { `[`expr`][ColumnsSelectionDsl.expr]` { name.`[`length`][String.length]` }.`[`desc`][SortDsl.desc]`() }` + * + * @param [name] The name the temporary column. Is empty by default ("untitled" in the DataFrame). + * @param [infer] [An enum][org.jetbrains.kotlinx.dataframe.api.Infer.Infer] that indicates how [DataColumn.type][org.jetbrains.kotlinx.dataframe.DataColumn.type] should be calculated. + * Either [None][org.jetbrains.kotlinx.dataframe.api.Infer.None], [Nulls][org.jetbrains.kotlinx.dataframe.api.Infer.Nulls], or [Type][org.jetbrains.kotlinx.dataframe.api.Infer.Type]. By default: [Nulls][Infer.Nulls]. + * @param [expression] An [AddExpression] to define what each new row of the temporary column should contain. + * @see [ColumnsContainer.mapToColumn] + */ +@Interpretable("Expr0") +public inline fun ColumnsSelectionDsl.expr( + name: String = "", + infer: Infer = Infer.Nulls, + noinline expression: AddExpression, +): DataColumn = mapToColumn(name, infer, expression) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/filter.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/filter.kt new file mode 100644 index 000000000..06c410ee0 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/filter.kt @@ -0,0 +1,141 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.ColumnSelector +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.Predicate +import org.jetbrains.kotlinx.dataframe.RowFilter +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.asColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.getTrueIndices +import org.jetbrains.kotlinx.dataframe.indices +import kotlin.reflect.KProperty + +// region DataColumn + +public fun DataColumn.filter(predicate: Predicate): DataColumn = + indices + .filter { predicate(get(it)) } + .let { get(it) } + +// endregion + +// region DataFrame + +public fun DataFrame.filter(predicate: RowFilter): DataFrame = + indices.filter { + val row = get(it) + predicate(row, row) + }.let { get(it) } + +public fun DataFrame.filterBy(column: ColumnSelector): DataFrame = + getRows(getColumn(column).toList().getTrueIndices()) + +public fun DataFrame.filterBy(column: String): DataFrame = filterBy { column.toColumnOf() } + +public fun DataFrame.filterBy(column: ColumnReference): DataFrame = filterBy { column } + +public fun DataFrame.filterBy(column: KProperty): DataFrame = filterBy { column.toColumnAccessor() } + +// endregion + +internal fun ColumnsSelector.filter(predicate: (ColumnWithPath) -> Boolean): ColumnsSelector = + { this@filter(it).asColumnSet().filter(predicate) } + +// region ColumnsSelectionDsl + +/** + * ## Filter [ColumnSet] [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface FilterColumnsSelectionDsl { + + /** + * ## Filter [ColumnSet] Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + * + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`filter`**][org.jetbrains.kotlinx.dataframe.api.FilterColumnsSelectionDsl.filter]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** __`.`__[**`filter`**][ColumnsSelectionDsl.filter] */ + public interface ColumnSetName + } + + /** + * ## Filter [ColumnSet] + * + * Creates a subset of columns ([ColumnSet]) from the current [ColumnSet] that + * adhere to the given [predicate]. + * + * Aside from calling [filter][ColumnSet.filter] directly, you can also use the [get][ColumnsSelectionDsl.get] operator + * in most cases. This function belongs to [cols][ColumnsSelectionDsl.cols] but operates identically. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[`remove`][DataFrame.remove]` { `[`all`][ColumnsSelectionDsl.all]`().`[`filter`][ColumnSet.filter]` { it.`[`hasNulls`][DataColumn.hasNulls]`() } }` + * + * `// and although this can be shortened to just the `[`colsOf`][colsOf]` call:` + * + * `df.`[`select`][DataFrame.select]` { `[`colsOf`][colsOf]`<`[`String`][String]`>().`[`filter`][ColumnSet.filter]` { "e" `[`in`][String.contains]` it.`[`name`][ColumnPath.name]`() } }` + * + * `df.`[`select`][DataFrame.select]` { `[`colsOf`][SingleColumn.colsOf]`<`[`String`][String]`>()`[`[`][ColumnsSelectionDsl.cols]`{ it.`[`any`][ColumnWithPath.any]` { it == "Alice" } }`[`]`][ColumnsSelectionDsl.cols]` }` + * + * @param [predicate] A [ColumnFilter function][ColumnFilter] that takes a [ColumnReference] and returns a [Boolean]. + * @return A [ColumnSet] containing the columns that match the given [predicate]. + * @see [ColumnsSelectionDsl.cols] + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.filter(predicate: ColumnFilter): TransformableColumnSet = + colsInternal(predicate as ColumnFilter<*>) as TransformableColumnSet +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt new file mode 100644 index 000000000..bbfd66d75 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/first.kt @@ -0,0 +1,391 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowFilter +import org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.asColumnSet +import org.jetbrains.kotlinx.dataframe.columns.size +import org.jetbrains.kotlinx.dataframe.columns.values +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableSingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.singleOrNullWithTransformerImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.transform +import org.jetbrains.kotlinx.dataframe.nrow +import kotlin.reflect.KProperty + +// region DataColumn + +public fun DataColumn.first(): T = get(0) + +public fun DataColumn.firstOrNull(): T? = if (size > 0) first() else null + +public fun DataColumn.first(predicate: (T) -> Boolean): T = values.first(predicate) + +public fun DataColumn.firstOrNull(predicate: (T) -> Boolean): T? = values.firstOrNull(predicate) + +// endregion + +// region DataFrame + +public fun DataFrame.first(): DataRow { + if (nrow == 0) { + throw NoSuchElementException("DataFrame has no rows. Use `firstOrNull`.") + } + return get(0) +} + +public fun DataFrame.firstOrNull(): DataRow? = if (nrow > 0) first() else null + +public fun DataFrame.first(predicate: RowFilter): DataRow = rows().first { predicate(it, it) } + +public fun DataFrame.firstOrNull(predicate: RowFilter): DataRow? = rows().firstOrNull { predicate(it, it) } + +// endregion + +// region GroupBy + +public fun GroupBy.first(): ReducedGroupBy = reduce { firstOrNull() } + +public fun GroupBy.first(predicate: RowFilter): ReducedGroupBy = reduce { firstOrNull(predicate) } + +// endregion + +// region Pivot + +public fun Pivot.first(): ReducedPivot = reduce { firstOrNull() } + +public fun Pivot.first(predicate: RowFilter): ReducedPivot = reduce { firstOrNull(predicate) } + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.first(): ReducedPivotGroupBy = reduce { firstOrNull() } + +public fun PivotGroupBy.first(predicate: RowFilter): ReducedPivotGroupBy = + reduce { firstOrNull(predicate) } + +// endregion + +// region ColumnsSelectionDsl + +/** + * ## First (Col) [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface FirstColumnsSelectionDsl { + + /** + * ## First (Col) Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`first`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`first`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`firstCol`**][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.firstCol]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`first`**][ColumnsSelectionDsl.first] */ + public interface PlainDslName + + /** __`.`__[**`first`**][ColumnsSelectionDsl.first] */ + public interface ColumnSetName + + /** __`.`__[**`firstCol`**][ColumnsSelectionDsl.firstCol] */ + public interface ColumnGroupName + } + + /** + * ## First (Col) + * + * Returns the first column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][ColumnGroup], `first` is named `firstCol` instead to avoid confusion. + * + * ### Check out: [Grammar] + * + * #### Examples: + * + * `df.`[select][DataFrame.select]` { `[first][ColumnsSelectionDsl.first]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[firstCol][String.firstCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * #### Examples for this overload: + * + * + * + * @param [condition] The optional [ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn] containing the first column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.last] + */ + private interface CommonFirstDocs { + + /** Examples key */ + interface Examples + } + + /** + * ## First (Col) + * + * Returns the first column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `first` is named `firstCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[firstCol][kotlin.String.firstCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[first][ColumnSet.first]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>().`[first][ColumnSet.first]`() }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the first column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.last] + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.first(condition: ColumnFilter = { true }): TransformableSingleColumn = + (allColumnsInternal() as TransformableColumnSet) + .transform { listOf(it.first(condition)) } + .singleOrNullWithTransformerImpl() + + /** + * ## First (Col) + * + * Returns the first column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `first` is named `firstCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[firstCol][kotlin.String.firstCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[first][ColumnsSelectionDsl.first]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the first column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.last] + */ + public fun ColumnsSelectionDsl<*>.first(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + asSingleColumn().firstCol(condition) + + /** + * ## First (Col) + * + * Returns the first column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `first` is named `firstCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[firstCol][kotlin.String.firstCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[firstCol][SingleColumn.firstCol]`() }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the first column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.last] + */ + public fun SingleColumn>.firstCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + this.ensureIsColumnGroup().asColumnSet().first(condition) + + /** + * ## First (Col) + * + * Returns the first column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `first` is named `firstCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[firstCol][kotlin.String.firstCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[firstCol][String.firstCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the first column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.last] + */ + public fun String.firstCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + columnGroup(this).firstCol(condition) + + /** + * ## First (Col) + * + * Returns the first column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `first` is named `firstCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[firstCol][kotlin.String.firstCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[firstCol][SingleColumn.firstCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[firstCol][KProperty.firstCol]`() }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the first column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.last] + */ + public fun KProperty<*>.firstCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + columnGroup(this).firstCol(condition) + + /** + * ## First (Col) + * + * Returns the first column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `first` is named `firstCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FirstColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[first][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.first]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[firstCol][kotlin.String.firstCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[firstCol][ColumnPath.firstCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the first column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.last] + */ + public fun ColumnPath.firstCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + columnGroup(this).firstCol(condition) +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/forEach.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/forEach.kt new file mode 100644 index 000000000..155ad6c14 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/forEach.kt @@ -0,0 +1,30 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.columns.values + +// region DataColumn + +public inline fun DataColumn.forEach(action: (T) -> Unit): Unit = values().forEach(action) + +public inline fun DataColumn.forEachIndexed(action: (Int, T) -> Unit): Unit = values().forEachIndexed(action) + +// endregion + +// region DataFrame + +public inline fun DataFrame.forEach(action: RowExpression): Unit = rows().forEach { action(it, it) } + +// endregion + +// region GroupBy + +public inline fun GroupBy.forEach(body: (GroupBy.Entry) -> Unit): Unit = + keys.forEach { key -> + val group = groups[key.index()] + body(GroupBy.Entry(key, group)) + } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/format.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/format.kt new file mode 100644 index 000000000..9c2465800 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/format.kt @@ -0,0 +1,158 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowValueFilter +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.MergedAttributes +import org.jetbrains.kotlinx.dataframe.impl.api.SingleAttribute +import org.jetbrains.kotlinx.dataframe.impl.api.encode +import org.jetbrains.kotlinx.dataframe.impl.api.formatImpl +import org.jetbrains.kotlinx.dataframe.impl.api.linearGradient +import org.jetbrains.kotlinx.dataframe.io.DataFrameHtmlData +import org.jetbrains.kotlinx.dataframe.io.DisplayConfiguration +import org.jetbrains.kotlinx.dataframe.io.toHTML +import org.jetbrains.kotlinx.dataframe.io.toStandaloneHTML +import kotlin.reflect.KProperty + +// region DataFrame + +// region format + +public fun DataFrame.format(columns: ColumnsSelector): FormatClause = FormatClause(this, columns) + +public fun DataFrame.format(vararg columns: String): FormatClause = format { columns.toColumnSet() } + +public fun DataFrame.format(vararg columns: ColumnReference): FormatClause = + format { columns.toColumnSet() } + +public fun DataFrame.format(vararg columns: KProperty): FormatClause = + format { columns.toColumnSet() } + +public fun DataFrame.format(): FormatClause = FormatClause(this) + +// endregion + +public fun FormatClause.perRowCol(formatter: RowColFormatter): FormattedFrame = + formatImpl(formatter) + +public fun FormatClause.with(formatter: CellFormatter): FormattedFrame = + formatImpl { row, col -> formatter(row[col]) } + +public fun FormatClause.where(filter: RowValueFilter): FormatClause = + FormatClause(filter = filter, df = df, columns = columns, oldFormatter = oldFormatter) + +public fun FormattedFrame.format(): FormatClause = FormatClause(df, null, formatter) + +// endregion + +public data class RGBColor(val r: Short, val g: Short, val b: Short) + +public interface CellAttributes { + + public fun attributes(): List> +} + +public infix fun CellAttributes?.and(other: CellAttributes?): CellAttributes? = + when { + other == null -> this + this == null -> other + else -> MergedAttributes(listOf(this, other)) + } + +public object FormattingDSL { + public fun rgb(r: Short, g: Short, b: Short): RGBColor = RGBColor(r, g, b) + + public val black: RGBColor = rgb(0, 0, 0) + + public val white: RGBColor = rgb(255, 255, 255) + + public val green: RGBColor = rgb(0, 255, 0) + + public val red: RGBColor = rgb(255, 0, 0) + + public val blue: RGBColor = rgb(0, 0, 255) + + public val gray: RGBColor = rgb(128, 128, 128) + + public val darkGray: RGBColor = rgb(169, 169, 169) + + public val lightGray: RGBColor = rgb(211, 211, 211) + + public fun attr(name: String, value: String): CellAttributes = SingleAttribute(name, value) + + public fun background(color: RGBColor): CellAttributes = attr("background-color", color.encode()) + + public fun background(r: Short, g: Short, b: Short): CellAttributes = background(RGBColor(r, g, b)) + + public fun textColor(color: RGBColor): CellAttributes = attr("color", color.encode()) + + public fun textColor(r: Short, g: Short, b: Short): CellAttributes = textColor(RGBColor(r, g, b)) + + public val italic: CellAttributes = attr("font-style", "italic") + + public val bold: CellAttributes = attr("font-weight", "bold") + + public val underline: CellAttributes = attr("text-decoration", "underline") + + public fun linearBg(value: Number, from: Pair, to: Pair): CellAttributes = + background( + linear(value, from, to), + ) + + public fun linear(value: Number, from: Pair, to: Pair): RGBColor { + val a = from.first.toDouble() + val b = to.first.toDouble() + if (a < b) return linearGradient(value.toDouble(), a, from.second, b, to.second) + return linearGradient(value.toDouble(), b, to.second, a, from.second) + } +} + +public typealias RowColFormatter = FormattingDSL.(DataRow, DataColumn) -> CellAttributes? + +public class FormattedFrame(internal val df: DataFrame, internal val formatter: RowColFormatter? = null) { + /** + * @return DataFrameHtmlData without additional definitions. Can be rendered in Jupyter kernel environments + */ + public fun toHTML(configuration: DisplayConfiguration = DisplayConfiguration.DEFAULT): DataFrameHtmlData = + df.toHTML(getDisplayConfiguration(configuration)) + + /** + * @return DataFrameHtmlData with table script and css definitions. Can be saved as an *.html file and displayed in the browser + */ + public fun toStandaloneHTML(configuration: DisplayConfiguration = DisplayConfiguration.DEFAULT): DataFrameHtmlData = + df.toStandaloneHTML(getDisplayConfiguration(configuration)) + + public fun getDisplayConfiguration(configuration: DisplayConfiguration): DisplayConfiguration = + configuration.copy(cellFormatter = formatter as RowColFormatter<*, *>?) +} + +public class FormatClause( + internal val df: DataFrame, + internal val columns: ColumnsSelector? = null, + internal val oldFormatter: RowColFormatter? = null, + internal val filter: RowValueFilter = { true }, +) { + override fun toString(): String = + "FormatClause(df=$df, columns=$columns, oldFormatter=$oldFormatter, filter=$filter)" +} + +public fun FormattedFrame.format(columns: ColumnsSelector): FormatClause = + FormatClause(df, columns, formatter) + +public typealias CellFormatter = FormattingDSL.(V) -> CellAttributes? + +public fun FormatClause.linearBg( + from: Pair, + to: Pair, +): FormattedFrame = + with { + if (it != null) { + background(linear(it, from, to)) + } else { + null + } + } diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/frameCol.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/frameCol.kt new file mode 100644 index 000000000..1536ac368 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/frameCol.kt @@ -0,0 +1,3475 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnGroupAccessor +import org.jetbrains.kotlinx.dataframe.ColumnGroupReference +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.getAt +import org.jetbrains.kotlinx.dataframe.impl.columns.onResolve +import org.jetbrains.kotlinx.dataframe.impl.columns.singleImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Frame Col [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + * @param _UNUSED [#KT-68546](https://youtrack.jetbrains.com/issue/KT-68546/Conflicting-overloads-in-non-generic-interface-K2-2.0.0) + */ +public interface FrameColColumnsSelectionDsl { + + /** + * ## Frame Col Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `index: `[`Int`][Int] + * + *      + * + * `T: Column type` + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`frameCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`frameCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]**`(`**[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`frameCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`frameCol`**][ColumnsSelectionDsl.frameCol] */ + public interface PlainDslName + + /** __`.`__[**`frameCol`**][ColumnsSelectionDsl.frameCol] */ + public interface ColumnSetName + + /** __`.`__[**`frameCol`**][ColumnsSelectionDsl.frameCol] */ + public interface ColumnGroupName + } + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor] (or [SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath], [KProperty], or [ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { `[frameCol][frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][DataFrame.select]` { `[frameCol][frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[frameCol][frameCol]`(1) }` + * + * #### Examples for this overload: + * + * + * + * To create a [ColumnAccessor] for another kind of column, take a look at the functions + * [col][ColumnsSelectionDsl.col], + * [colGroup][ColumnsSelectionDsl.colGroup], + * and [valueCol][ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + */ + private interface CommonFrameColDocs { + + // Example argument, can be either {@include [SingleExample]} or {@include [DoubleExample]} + interface ExampleArg + + /** + * `df.`[select][DataFrame.select]` { `[frameCol][frameCol]`() }` + */ + interface SingleExample + + /** + * `df.`[select][DataFrame.select]` { `[frameCol][frameCol]`() }` + * + * `df.`[select][DataFrame.select]` { `[frameCol][frameCol]`<`[String][String]`>() }` + */ + interface DoubleExample + + // Receiver argument for the example(s) + interface ReceiverArg + + // Argument for the example(s) + interface Arg + + // Optional note + interface Note + + /** @param [C] The type of the frame column. */ + interface FrameColumnTypeParam + } + + // region reference + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor] pointing to the value column. + * @param [C] The type of the frame column. + */ + private interface FrameColReferenceDocs + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the frame column. + */ + public fun frameCol(frameCol: ColumnAccessor>): ColumnAccessor> = + frameCol.ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the frame column. + */ + public fun SingleColumn>.frameCol( + frameCol: ColumnAccessor>, + ): SingleColumn> = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(frameCol) + ?: throw IllegalStateException( + "FrameColumn '${frameCol.path()}' not found in column group '${it.path}'", + ) + child.data.ensureIsFrameColumn() + listOf(child) + }.singleImpl() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the frame column. + */ + public fun AnyColumnGroupAccessor.frameCol( + frameCol: ColumnAccessor>, + ): ColumnAccessor> = this.ensureIsColumnGroup().frameColumn(frameCol.path()).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the frame column. + */ + public fun String.frameCol(frameCol: ColumnAccessor>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(frameCol.path()).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the frame column. + */ + public fun KProperty<*>.frameCol(frameCol: ColumnAccessor>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(frameCol.path()).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the frame column. + */ + public fun ColumnPath.frameCol(frameCol: ColumnAccessor>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(frameCol.path()).ensureIsFrameColumn() + + // endregion + + // region name + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + private interface FrameColNameDocs + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun frameCol(name: String): ColumnAccessor> = frameColumn(name).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the frame column. + */ + public fun frameCol(name: String): ColumnAccessor> = frameColumn(name).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun SingleColumn>.frameCol(name: String): SingleColumn> = frameCol(name) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the frame column. + */ + public fun SingleColumn>.frameCol(name: String): SingleColumn> = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(name)?.cast>() + ?: throw IllegalStateException("Frame column '$name' not found in column group '${it.path}'") + child.data.ensureIsFrameColumn() + listOf(child) + }.singleImpl() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun AnyColumnGroupAccessor.frameCol(name: String): ColumnAccessor> = frameCol(name) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the frame column. + */ + public fun AnyColumnGroupAccessor.frameCol(name: String): ColumnAccessor> = + this.ensureIsColumnGroup().frameColumn(name).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun String.frameCol(name: String): ColumnAccessor> = frameCol(name) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the frame column. + */ + public fun String.frameCol(name: String): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(name).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun KProperty<*>.frameCol(name: String): ColumnAccessor> = frameCol(name) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the frame column. + */ + public fun KProperty<*>.frameCol(name: String): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(name).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun ColumnPath.frameCol(name: String): ColumnAccessor> = frameCol(name) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("frameColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the frame column. + */ + public fun ColumnPath.frameCol(name: String): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(name).ensureIsFrameColumn() + + // endregion + + // region path + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + private interface FrameColPathDocs + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun frameCol(path: ColumnPath): ColumnAccessor> = frameColumn(path).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the frame column. + */ + public fun frameCol(path: ColumnPath): ColumnAccessor> = frameColumn(path).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun SingleColumn>.frameCol(path: ColumnPath): SingleColumn> = frameCol(path) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the frame column. + */ + public fun SingleColumn>.frameCol(path: ColumnPath): SingleColumn> = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(path)?.cast>() + ?: throw IllegalStateException("Frame column '$path' not found in column group '${it.path}'") + child.data.ensureIsFrameColumn() + listOf(child) + }.singleImpl() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun AnyColumnGroupAccessor.frameCol(path: ColumnPath): ColumnAccessor> = frameCol(path) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the frame column. + */ + public fun AnyColumnGroupAccessor.frameCol(path: ColumnPath): ColumnAccessor> = + this.ensureIsColumnGroup().frameColumn(path).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun String.frameCol(path: ColumnPath): ColumnAccessor> = frameCol(path) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the frame column. + */ + public fun String.frameCol(path: ColumnPath): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(path).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun KProperty<*>.frameCol(path: ColumnPath): ColumnAccessor> = frameCol(path) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the frame column. + */ + public fun KProperty<*>.frameCol(path: ColumnPath): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(path).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun ColumnPath.frameCol(path: ColumnPath): ColumnAccessor> = frameCol(path) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`("pathTo"["frameColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("pathTo"["frameColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the frame column. + */ + public fun ColumnPath.frameCol(path: ColumnPath): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(path).ensureIsFrameColumn() + + // endregion + + // region property + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + private interface FrameColKPropertyDocs + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColDataFrameKProperty") + public fun frameCol(property: KProperty>): SingleColumn> = + frameColumn(property).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + public fun frameCol(property: KProperty>): SingleColumn> = + frameColumn(property).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColDataFrameKProperty") + public fun SingleColumn>.frameCol(property: KProperty>): SingleColumn> = + frameCol(property.name) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + public fun SingleColumn>.frameCol(property: KProperty>): SingleColumn> = + frameCol(property.name) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColDataFrameKProperty") + public fun AnyColumnGroupAccessor.frameCol(property: KProperty>): ColumnAccessor> = + this.ensureIsColumnGroup().frameColumn(property).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + public fun AnyColumnGroupAccessor.frameCol(property: KProperty>): ColumnAccessor> = + this.ensureIsColumnGroup().frameColumn(property).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColDataFrameKProperty") + public fun String.frameCol(property: KProperty>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(property).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + public fun String.frameCol(property: KProperty>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(property).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColDataFrameKProperty") + public fun KProperty<*>.frameCol(property: KProperty>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(property).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + public fun KProperty<*>.frameCol(property: KProperty>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(property).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColDataFrameKProperty") + public fun ColumnPath.frameCol(property: KProperty>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(property).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(Type::frameColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the frame column. + */ + public fun ColumnPath.frameCol(property: KProperty>): ColumnAccessor> = + columnGroup(this).ensureIsColumnGroup().frameColumn(property).ensureIsFrameColumn() + + // endregion + + // region index + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + private interface FrameColIndexDocs + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the frame column. + * + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("ColumnSetDataFrameFrameColIndex") + public fun ColumnSet>.frameCol(index: Int): SingleColumn> = + getAt(index).ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the frame column. + * + */ + public fun ColumnSet<*>.frameCol(index: Int): SingleColumn> = + getAt(index).cast>().ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun ColumnsSelectionDsl<*>.frameCol(index: Int): SingleColumn> = frameCol(index) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the frame column. + */ + public fun ColumnsSelectionDsl<*>.frameCol(index: Int): SingleColumn> = + asSingleColumn().frameCol(index) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun SingleColumn>.frameCol(index: Int): SingleColumn> = frameCol(index) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the frame column. + */ + public fun SingleColumn>.frameCol(index: Int): SingleColumn> = + this + .ensureIsColumnGroup() + .allColumnsInternal() + .getAt(index) + .cast>() + .ensureIsFrameColumn() + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun String.frameCol(index: Int): SingleColumn> = frameCol(index) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the frame column. + */ + public fun String.frameCol(index: Int): SingleColumn> = columnGroup(this).frameCol(index) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun KProperty<*>.frameCol(index: Int): SingleColumn> = frameCol(index) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the frame column. + */ + public fun KProperty<*>.frameCol(index: Int): SingleColumn> = columnGroup(this).frameCol(index) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("frameColUnTyped") + public fun ColumnPath.frameCol(index: Int): SingleColumn> = frameCol(index) + + /** + * ## Frame Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a frame column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [frameColumn][org.jetbrains.kotlinx.dataframe.api.frameColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a frame column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a frame column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>("frameColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(SomeType::frameColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[frameCol][org.jetbrains.kotlinx.dataframe.api.FrameColColumnsSelectionDsl.frameCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [valueCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the frame column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a frame column. + * + * @see [frameColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.valueCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the frame column. + */ + public fun ColumnPath.frameCol(index: Int): SingleColumn> = columnGroup(this).frameCol(index) + + // endregion +} + +/** + * Checks the validity of this [SingleColumn], + * by adding a check to see it's a [FrameColumn] (so, a [SingleColumn]<*>) + * and throwing an [IllegalArgumentException] if it's not. + */ +internal fun SingleColumn>.ensureIsFrameColumn(): SingleColumn> = + onResolve { col: ColumnWithPath<*>? -> + require(col?.isFrameColumn() != false) { + "Column at ${col?.path} is not a FrameColumn, but a ${col?.kind()}." + } + } + +/** Checks the validity of this [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn], + * by adding a check to see it's a [FrameColumn][org.jetbrains.kotlinx.dataframe.columns.FrameColumn] (so, a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]<*>) + * and throwing an [IllegalArgumentException] if it's not. */ +internal fun ColumnAccessor>.ensureIsFrameColumn(): ColumnAccessor> = + onResolve { col: ColumnWithPath<*>? -> + require(col?.isFrameColumn() != false) { + "Column at ${col?.path} is not a FrameColumn, but a ${col?.kind()}." + } + } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/frameCols.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/frameCols.kt new file mode 100644 index 000000000..74a91151f --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/frameCols.kt @@ -0,0 +1,370 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Predicate +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.documentation.AccessApi +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Frame Columns [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface FrameColsColumnsSelectionDsl { + + /** + * ## Frame Cols Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`frameCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`frameCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`frameCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroups]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`frameCols`**][ColumnsSelectionDsl.colGroups] */ + public interface PlainDslName + + /** __`.`__[**`frameCols`**][ColumnsSelectionDsl.colGroups] */ + public interface ColumnSetName + + /** __`.`__[**`frameCols`**][ColumnsSelectionDsl.colGroups] */ + public interface ColumnGroupName + } + + /** + * ## Frame Columns + * Creates a subset of columns from [this] that are [FrameColumns][FrameColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [frameCols] can be called using any of the supported [APIs][AccessApi] (+ [ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { `[frameCols][SingleColumn.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { `[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]`().`[frameCols][SingleColumn.frameCols]`() }` + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[frameCols][String.frameCols]`() }` + * + * #### Examples for this overload: + * + * + * + * @param [filter] An optional [predicate][Predicate] to filter the frame columns by. + * @return A [ColumnSet] of [FrameColumns][FrameColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + private interface CommonFrameColsDocs { + + /** Example argument */ + interface ExampleArg + } + + /** + * ## Frame Columns + * Creates a subset of columns from [this] that are [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [frameCols][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.frameCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[frameCols][kotlin.String.frameCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") }.`[frameCols][ColumnSet.frameCols]`() }` + * + * `// NOTE: This can be shortened to just:` + * + * `df.`[select][DataFrame.select]` { `[frameCols][ColumnsSelectionDsl.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the frame columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + @Interpretable("FrameCols0") + public fun ColumnSet<*>.frameCols( + filter: Predicate> = { true }, + ): TransformableColumnSet> = frameColumnsInternal(filter) + + /** + * ## Frame Columns + * Creates a subset of columns from [this] that are [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [frameCols][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.frameCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[frameCols][kotlin.String.frameCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[frameCols][ColumnsSelectionDsl.frameCols]`() }` + * + * `df.`[select][DataFrame.select]` { `[frameCols][ColumnsSelectionDsl.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the frame columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun ColumnsSelectionDsl<*>.frameCols( + filter: Predicate> = { true }, + ): TransformableColumnSet> = asSingleColumn().frameColumnsInternal(filter) + + /** + * ## Frame Columns + * Creates a subset of columns from [this] that are [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [frameCols][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.frameCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[frameCols][kotlin.String.frameCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColGroup.`[frameCols][SingleColumn.frameCols]`() }` + * + * `df.`[select][DataFrame.select]` { myColGroup.`[frameCols][SingleColumn.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the frame columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun SingleColumn>.frameCols( + filter: Predicate> = { true }, + ): TransformableColumnSet> = this.ensureIsColumnGroup().frameColumnsInternal(filter) + + /** + * ## Frame Columns + * Creates a subset of columns from [this] that are [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [frameCols][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.frameCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[frameCols][kotlin.String.frameCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[frameCols][String.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[frameCols][String.frameCols]`() }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the frame columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun String.frameCols(filter: Predicate> = { true }): TransformableColumnSet> = + columnGroup(this).frameCols(filter) + + /** + * ## Frame Columns + * Creates a subset of columns from [this] that are [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [frameCols][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.frameCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[frameCols][kotlin.String.frameCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colGroup][ColumnsSelectionDsl.colGroup]`(Type::myColGroup).`[frameCols][SingleColumn.frameCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { Type::myColGroup.`[frameCols][SingleColumn.frameCols]`() }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColGroup.`[frameCols][KProperty.frameCols]`() }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the frame columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun KProperty<*>.frameCols( + filter: Predicate> = { true }, + ): TransformableColumnSet> = columnGroup(this).frameCols(filter) + + /** + * ## Frame Columns + * Creates a subset of columns from [this] that are [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [frameCols][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.frameCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.FrameColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[frameCols][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.frameCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[frameCols][kotlin.String.frameCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myGroupCol"].`[frameCols][ColumnPath.frameCols]`() }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the frame columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [FrameColumns][org.jetbrains.kotlinx.dataframe.columns.FrameColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.valueCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun ColumnPath.frameCols( + filter: Predicate> = { true }, + ): TransformableColumnSet> = columnGroup(this).frameCols(filter) +} + +/** + * Returns a TransformableColumnSet containing the frame columns that satisfy the given filter. + * + * @param filter The filter function to apply on each frame column. Must accept a FrameColumn object and return a Boolean. + * @return A [TransformableColumnSet] containing the frame columns that satisfy the filter. + */ +@Suppress("UNCHECKED_CAST") +internal fun ColumnsResolver<*>.frameColumnsInternal( + filter: (FrameColumn<*>) -> Boolean, +): TransformableColumnSet = + colsInternal { it.isFrameColumn() && filter(it.asFrameColumn()) } as TransformableColumnSet + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/frames.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/frames.kt new file mode 100644 index 000000000..7f82f8fc5 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/frames.kt @@ -0,0 +1,16 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow + +// region Pivot + +public fun Pivot.frames(): DataRow = aggregate { this } + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.frames(): DataFrame = aggregate { this } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/gather.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/gather.kt new file mode 100644 index 000000000..52446cbd1 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/gather.kt @@ -0,0 +1,106 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.RowValueFilter +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.gatherImpl +import org.jetbrains.kotlinx.dataframe.impl.columnName +import kotlin.reflect.KProperty +import kotlin.reflect.KType +import kotlin.reflect.typeOf + +// region gather + +public fun DataFrame.gather(selector: ColumnsSelector): Gather = + Gather( + df = this, + columns = selector, + filter = null, + keyType = typeOf(), + keyTransform = { it }, + valueTransform = null, + ) + +public fun DataFrame.gather(vararg columns: String): Gather = + gather { columns.toColumnSet() } + +public fun DataFrame.gather(vararg columns: ColumnReference): Gather = + gather { columns.toColumnSet() } + +public fun DataFrame.gather(vararg columns: KProperty): Gather = + gather { columns.toColumnSet() } + +// endregion + +public fun Gather.where(filter: RowValueFilter): Gather = + copy(filter = this.filter and filter) + +public fun Gather.notNull(): Gather = where { it != null } as Gather + +public fun Gather.explodeLists(): Gather = copy(explode = true) + +public inline fun Gather.mapKeys( + noinline transform: (String) -> K, +): Gather = + copy(keyTransform = transform as ((String) -> Nothing), keyType = typeOf()) as Gather + +public fun Gather.mapValues(transform: (C) -> R): Gather = + copy(valueTransform = transform as ((C) -> Nothing)) as Gather + +public data class Gather( + internal val df: DataFrame, + internal val columns: ColumnsSelector, + internal val filter: RowValueFilter? = null, + internal val keyType: KType? = null, + internal val keyTransform: ((String) -> K), + internal val valueTransform: ((C) -> R)? = null, + internal val explode: Boolean = false, +) { + public fun

cast(): Split = this as Split + + override fun toString(): String = "Split(df=$df, columns=$columns)" +} + +public data class SplitWithTransform( + internal val df: DataFrame, + internal val columns: ColumnsSelector, + internal val inward: Boolean, + internal val tartypeOf: KType, + internal val default: R? = null, + internal val transform: DataRow.(C) -> Iterable, +) + +public typealias ColumnNamesGenerator = ColumnWithPath.(extraColumnIndex: Int) -> String + +// region default + +public inline fun , reified R> Split.default(value: R?): SplitWithTransform = + by { it }.default(value) + +public fun Split.default(value: String?): SplitWithTransform = + by { it.splitDefault() }.default(value) + +public fun SplitWithTransform.default(value: R?): SplitWithTransform = copy(default = value) + +// endregion + +// region by + +public inline fun Split.by( + noinline splitter: DataRow.(C) -> Iterable, +): SplitWithTransform = by(typeOf(), splitter) + +public fun Split.by( + vararg delimiters: Char, + trim: Boolean = true, + ignoreCase: Boolean = false, + limit: Int = 0, +): SplitWithTransform = + by { + it.toString().split(*delimiters, ignoreCase = ignoreCase, limit = limit).let { + if (trim) it.map { it.trim() } else it + } + } + +public fun Split.by( + regex: Regex, + trim: Boolean = true, + limit: Int = 0, +): SplitWithTransform = + by { + it.toString().split(regex, limit = limit).let { + if (trim) it.map { it.trim() } else it + } + } + +public fun Split.by( + vararg delimiters: String, + trim: Boolean = true, + ignoreCase: Boolean = false, + limit: Int = 0, +): SplitWithTransform = + by { + it.toString().split(*delimiters, ignoreCase = ignoreCase, limit = limit).let { + if (trim) it.map { it.trim() } else it + } + } + +@PublishedApi +internal fun Split.by( + type: KType, + splitter: DataRow.(C) -> Iterable, +): SplitWithTransform = + SplitWithTransform(df, columns, false, type) { + if (it == null) emptyList() else splitter(it).asList() + } + +// endregion + +// region match + +public fun Split.match( + @Language("RegExp") regex: String, +): SplitWithTransform = match(regex.toRegex()) + +public fun Split.match(regex: Regex): SplitWithTransform = + by { + it?.let { + regex.matchEntire(it) + ?.groups + ?.drop(1) + ?.map { it?.value } + } ?: emptyList() + } + +// endregion + +internal fun Split.toDataFrame(): DataFrame = + by { + when (it) { + is List<*> -> it + is AnyFrame -> it.rows() + else -> listOf(it) + } + }.into() + +// region into + +public fun SplitWithTransform.into( + firstName: ColumnAccessor<*>, + vararg otherNames: ColumnAccessor<*>, +): DataFrame = into(listOf(firstName.name()) + otherNames.map { it.name() }) + +public fun SplitWithTransform.into( + firstName: KProperty<*>, + vararg otherNames: KProperty<*>, +): DataFrame = into(listOf(firstName.columnName) + otherNames.map { it.columnName }) + +public fun SplitWithTransform.into( + vararg names: String, + extraNamesGenerator: (ColumnWithPath.(extraColumnIndex: Int) -> String)? = null, +): DataFrame = into(names.toList(), extraNamesGenerator) + +public fun SplitWithTransform.into( + names: List, + extraNamesGenerator: (ColumnWithPath.(extraColumnIndex: Int) -> String)? = null, +): DataFrame = + splitImpl(this) { numberOfNewCols -> + if (extraNamesGenerator != null && names.size < numberOfNewCols) { + names + (1..(numberOfNewCols - names.size)).map { extraNamesGenerator(this, it) } + } else { + names + } + } + +public fun > Split.into( + vararg names: String, + extraNamesGenerator: ColumnNamesGenerator? = null, +): DataFrame = by { it }.into(names.toList(), extraNamesGenerator) + +@JvmName("splitDataFrameInto") +public fun Split>.into( + vararg names: String, + extraNamesGenerator: ColumnNamesGenerator>? = null, +): DataFrame = by { it.rows() }.into(names.toList(), extraNamesGenerator) + +public fun Split>.into(firstCol: String, secondCol: String): DataFrame = + by { listOf(it.first, it.second) }.into(firstCol, secondCol) + +public inline fun Split>.into( + firstCol: ColumnAccessor, + secondCol: ColumnAccessor, +): DataFrame = by { listOf(it.first, it.second) }.into(firstCol, secondCol) + +@JvmName("intoTC") +public fun Split.into( + vararg names: String, + extraNamesGenerator: (ColumnWithPath.(extraColumnIndex: Int) -> String)? = null, +): DataFrame = by { it.splitDefault() }.into(names.toList(), extraNamesGenerator) + +// endregion + +// region inward + +public fun SplitWithTransform.inward( + names: Iterable, + extraNamesGenerator: ColumnNamesGenerator? = null, +): DataFrame = copy(inward = true).into(names.toList(), extraNamesGenerator) + +public fun SplitWithTransform.inward( + vararg names: String, + extraNamesGenerator: ColumnNamesGenerator? = null, +): DataFrame = inward(names.toList(), extraNamesGenerator) + +public fun SplitWithTransform.inward( + firstName: ColumnAccessor<*>, + vararg otherNames: ColumnAccessor<*>, +): DataFrame = inward(listOf(firstName.name()) + otherNames.map { it.name() }) + +public fun SplitWithTransform.inward( + firstName: KProperty<*>, + vararg otherNames: KProperty<*>, +): DataFrame = inward(listOf(firstName.columnName) + otherNames.map { it.columnName }) + +public inline fun , reified R> Split.inward( + vararg names: String, + noinline extraNamesGenerator: ColumnNamesGenerator? = null, +): DataFrame = by { it }.inward(names.toList(), extraNamesGenerator) + +@JvmName("splitDataFrameInward") +public fun , R> Split.inward( + vararg names: String, + extraNamesGenerator: ColumnNamesGenerator? = null, +): DataFrame = by { it.rows() }.inward(names.toList(), extraNamesGenerator) + +public fun Split>.inward(firstCol: String, secondCol: String): DataFrame = + by { listOf(it.first, it.second) }.inward(firstCol, secondCol) + +public inline fun Split>.inward( + firstCol: ColumnAccessor, + secondCol: ColumnAccessor, +): DataFrame = by { listOf(it.first, it.second) }.inward(firstCol, secondCol) + +@JvmName("inwardTC") +public fun Split.inward( + vararg names: String, + extraNamesGenerator: (ColumnWithPath.(extraColumnIndex: Int) -> String)? = null, +): DataFrame = by { it.splitDefault() }.inward(names.toList(), extraNamesGenerator) + +// endregion + +// region intoColumns + +public fun Split.intoColumns(): DataFrame = + df.convert(columns).with { + when { + it == null -> null + it.isEmpty() -> DataRow.empty + else -> it.implode { all() }.single() + } + } + +// endregion + +// region intoRows + +@JvmName("intoRowsTC") +public inline fun , reified R> Split.intoRows(dropEmpty: Boolean = true): DataFrame = + by { it } + .intoRows(dropEmpty) + +@JvmName("intoRowsFrame") +public fun Split.intoRows(dropEmpty: Boolean = true): DataFrame = + by { it.rows() }.intoRows(dropEmpty) + +internal fun Convert.splitInplace(type: KType, transform: DataRow.(C) -> Iterable) = + withRowCellImpl(getListType(type), Infer.None) { if (it == null) emptyList() else transform(it).asList() } + +public fun SplitWithTransform.intoRows(dropEmpty: Boolean = true): DataFrame { + val paths = df.getColumnPaths(columns).toColumnSet() + return df.convert { paths as ColumnSet }.splitInplace(tartypeOf, transform).explode(dropEmpty) { paths } +} + +// endregion + +// region inplace + +@JvmName("inplaceTC") +public inline fun , reified R> Split.inplace(): DataFrame = by { it }.inplace() + +public fun SplitWithTransform.inplace(): DataFrame = + df.convert(columns).splitInplace(tartypeOf, transform) + +// endregion + +// region DataColumn + +public fun DataColumn>.splitInto(vararg names: String): AnyFrame = + toDataFrame().split { this@splitInto }.into(*names) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/std.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/std.kt new file mode 100644 index 000000000..af6a07ca7 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/std.kt @@ -0,0 +1,301 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.aggregation.ColumnsForAggregateSelector +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.columns.toColumnsSetOf +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.Aggregators +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.cast2 +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateAll +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateFor +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateOf +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.of +import org.jetbrains.kotlinx.dataframe.impl.aggregation.numberColumns +import org.jetbrains.kotlinx.dataframe.math.std +import kotlin.reflect.KProperty +import kotlin.reflect.typeOf + +// region DataColumn + +public fun DataColumn.std(skipNA: Boolean = skipNA_default, ddof: Int = ddof_default): Double = + Aggregators.std(skipNA, ddof).aggregate(this) ?: .0 + +public inline fun DataColumn.stdOf( + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + noinline expression: (T) -> R?, +): Double = Aggregators.std(skipNA, ddof).cast2().aggregateOf(this, expression) ?: .0 + +// endregion + +// region DataRow + +public fun AnyRow.rowStd(skipNA: Boolean = skipNA_default, ddof: Int = ddof_default): Double = + values().filterIsInstance().map { it.toDouble() }.std(skipNA, ddof) + +public inline fun AnyRow.rowStdOf(ddof: Int = ddof_default): Double = + values() + .filterIsInstance() + .std( + type = typeOf(), + ddof = ddof, + ) + +// endregion + +// region DataFrame + +public fun DataFrame.std(skipNA: Boolean = skipNA_default, ddof: Int = ddof_default): DataRow = + stdFor(skipNA, ddof, numberColumns()) + +public fun DataFrame.stdFor( + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + columns: ColumnsForAggregateSelector, +): DataRow = Aggregators.std(skipNA, ddof).aggregateFor(this, columns) + +public fun DataFrame.stdFor( + vararg columns: String, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataRow = stdFor(skipNA, ddof) { columns.toColumnsSetOf() } + +public fun DataFrame.stdFor( + vararg columns: ColumnReference, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataRow = stdFor(skipNA, ddof) { columns.toColumnSet() } + +public fun DataFrame.stdFor( + vararg columns: KProperty, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataRow = stdFor(skipNA, ddof) { columns.toColumnSet() } + +public fun DataFrame.std( + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + columns: ColumnsSelector, +): Double = Aggregators.std(skipNA, ddof).aggregateAll(this, columns) ?: .0 + +public fun DataFrame.std(vararg columns: ColumnReference): Double = std { columns.toColumnSet() } + +public fun DataFrame.std(vararg columns: String): Double = std { columns.toColumnsSetOf() } + +public fun DataFrame.std(vararg columns: KProperty): Double = std { columns.toColumnSet() } + +public inline fun DataFrame.stdOf( + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + crossinline expression: RowExpression, +): Double = Aggregators.std(skipNA, ddof).of(this, expression) ?: .0 + +// endregion + +// region GroupBy + +public fun Grouped.std(skipNA: Boolean = skipNA_default, ddof: Int = ddof_default): DataFrame = + stdFor(skipNA, ddof, numberColumns()) + +public fun Grouped.stdFor( + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + columns: ColumnsForAggregateSelector, +): DataFrame = Aggregators.std(skipNA, ddof).aggregateFor(this, columns) + +public fun Grouped.stdFor( + vararg columns: String, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = stdFor(skipNA, ddof) { columns.toColumnsSetOf() } + +public fun Grouped.stdFor( + vararg columns: ColumnReference, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = stdFor(skipNA, ddof) { columns.toColumnSet() } + +public fun Grouped.stdFor( + vararg columns: KProperty, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = stdFor(skipNA, ddof) { columns.toColumnSet() } + +public fun Grouped.std( + name: String? = null, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + columns: ColumnsSelector, +): DataFrame = Aggregators.std(skipNA, ddof).aggregateAll(this, name, columns) + +public fun Grouped.std( + vararg columns: ColumnReference, + name: String? = null, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = std(name, skipNA, ddof) { columns.toColumnSet() } + +public fun Grouped.std( + vararg columns: String, + name: String? = null, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = std(name, skipNA, ddof) { columns.toColumnsSetOf() } + +public fun Grouped.std( + vararg columns: KProperty, + name: String? = null, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = std(name, skipNA, ddof) { columns.toColumnSet() } + +public inline fun Grouped.stdOf( + name: String? = null, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + crossinline expression: RowExpression, +): DataFrame = Aggregators.std(skipNA, ddof).aggregateOf(this, name, expression) + +// endregion + +// region Pivot + +public fun Pivot.std( + separate: Boolean = false, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataRow = stdFor(separate, skipNA, ddof, numberColumns()) + +public fun Pivot.stdFor( + separate: Boolean = false, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + columns: ColumnsForAggregateSelector, +): DataRow = delegate { stdFor(separate, skipNA, ddof, columns) } + +public fun Pivot.stdFor( + vararg columns: String, + separate: Boolean = false, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataRow = stdFor(separate, skipNA, ddof) { columns.toColumnsSetOf() } + +public fun Pivot.stdFor( + vararg columns: ColumnReference, + separate: Boolean = false, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataRow = stdFor(separate, skipNA, ddof) { columns.toColumnSet() } + +public fun Pivot.stdFor( + vararg columns: KProperty, + separate: Boolean = false, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataRow = stdFor(separate, skipNA, ddof) { columns.toColumnSet() } + +public fun Pivot.std( + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + columns: ColumnsSelector, +): DataRow = delegate { std(skipNA, ddof, columns) } + +public fun Pivot.std( + vararg columns: ColumnReference, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataRow = std(skipNA, ddof) { columns.toColumnSet() } + +public fun Pivot.std( + vararg columns: String, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataRow = std(skipNA, ddof) { columns.toColumnsSetOf() } + +public fun Pivot.std( + vararg columns: KProperty, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataRow = std(skipNA, ddof) { columns.toColumnSet() } + +public inline fun Pivot.stdOf( + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + crossinline expression: RowExpression, +): DataRow = delegate { stdOf(skipNA, ddof, expression) } + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.std( + separate: Boolean = false, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = stdFor(separate, skipNA, ddof, numberColumns()) + +public fun PivotGroupBy.stdFor( + separate: Boolean = false, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + columns: ColumnsForAggregateSelector, +): DataFrame = Aggregators.std(skipNA, ddof).aggregateFor(this, separate, columns) + +public fun PivotGroupBy.stdFor( + vararg columns: String, + separate: Boolean = false, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = stdFor(separate, skipNA, ddof) { columns.toColumnsSetOf() } + +public fun PivotGroupBy.stdFor( + vararg columns: ColumnReference, + separate: Boolean = false, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = stdFor(separate, skipNA, ddof) { columns.toColumnSet() } + +public fun PivotGroupBy.stdFor( + vararg columns: KProperty, + separate: Boolean = false, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = stdFor(separate, skipNA, ddof) { columns.toColumnSet() } + +public fun PivotGroupBy.std( + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + columns: ColumnsSelector, +): DataFrame = Aggregators.std(skipNA, ddof).aggregateAll(this, columns) + +public fun PivotGroupBy.std( + vararg columns: ColumnReference, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = std(skipNA, ddof) { columns.toColumnSet() } + +public fun PivotGroupBy.std( + vararg columns: String, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = std(skipNA, ddof) { columns.toColumnsSetOf() } + +public fun PivotGroupBy.std( + vararg columns: KProperty, + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, +): DataFrame = std(skipNA, ddof) { columns.toColumnSet() } + +public inline fun PivotGroupBy.stdOf( + skipNA: Boolean = skipNA_default, + ddof: Int = ddof_default, + crossinline expression: RowExpression, +): DataFrame = Aggregators.std(skipNA, ddof).aggregateOf(this, expression) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/sum.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/sum.kt new file mode 100644 index 000000000..be579ca16 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/sum.kt @@ -0,0 +1,185 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.aggregation.ColumnsForAggregateSelector +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.columns.toColumnsSetOf +import org.jetbrains.kotlinx.dataframe.columns.values +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.Aggregator +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.Aggregators +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.cast +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateAll +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateFor +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateOf +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.of +import org.jetbrains.kotlinx.dataframe.impl.aggregation.numberColumns +import org.jetbrains.kotlinx.dataframe.impl.columns.toNumberColumns +import org.jetbrains.kotlinx.dataframe.impl.zero +import org.jetbrains.kotlinx.dataframe.math.sum +import org.jetbrains.kotlinx.dataframe.math.sumOf +import kotlin.reflect.KProperty +import kotlin.reflect.typeOf + +// region DataColumn + +@JvmName("sumT") +public fun DataColumn.sum(): T = values.sum(type()) + +@JvmName("sumTNullable") +public fun DataColumn.sum(): T = values.sum(type()) + +public inline fun DataColumn.sumOf(crossinline expression: (T) -> R): R? = + (Aggregators.sum as Aggregator<*, *>).cast().of(this, expression) + +// endregion + +// region DataRow + +public fun AnyRow.rowSum(): Number = Aggregators.sum.aggregateMixed(values().filterIsInstance()) ?: 0 + +public inline fun AnyRow.rowSumOf(): T = values().filterIsInstance().sum(typeOf()) + +// endregion + +// region DataFrame + +public fun DataFrame.sum(): DataRow = sumFor(numberColumns()) + +public fun DataFrame.sumFor(columns: ColumnsForAggregateSelector): DataRow = + Aggregators.sum.aggregateFor(this, columns) + +public fun DataFrame.sumFor(vararg columns: String): DataRow = sumFor { columns.toColumnsSetOf() } + +public fun DataFrame.sumFor(vararg columns: ColumnReference): DataRow = + sumFor { columns.toColumnSet() } + +public fun DataFrame.sumFor(vararg columns: KProperty): DataRow = + sumFor { columns.toColumnSet() } + +public inline fun DataFrame.sum(noinline columns: ColumnsSelector): C = + (Aggregators.sum.aggregateAll(this, columns) as C?) ?: C::class.zero() + +public inline fun DataFrame.sum(vararg columns: ColumnReference): C = + sum { columns.toColumnSet() } + +public fun DataFrame.sum(vararg columns: String): Number = sum { columns.toColumnsSetOf() } + +public inline fun DataFrame.sum(vararg columns: KProperty): C = + sum { columns.toColumnSet() } + +public inline fun DataFrame.sumOf(crossinline expression: RowExpression): C = + rows().sumOf(typeOf()) { expression(it, it) } + +// endregion + +// region GroupBy + +public fun Grouped.sum(): DataFrame = sumFor(numberColumns()) + +public fun Grouped.sumFor(columns: ColumnsForAggregateSelector): DataFrame = + Aggregators.sum.aggregateFor(this, columns) + +public fun Grouped.sumFor(vararg columns: String): DataFrame = sumFor { columns.toNumberColumns() } + +public fun Grouped.sumFor(vararg columns: ColumnReference): DataFrame = + sumFor { columns.toColumnSet() } + +public fun Grouped.sumFor(vararg columns: KProperty): DataFrame = + sumFor { columns.toColumnSet() } + +public fun Grouped.sum(name: String? = null, columns: ColumnsSelector): DataFrame = + Aggregators.sum.aggregateAll(this, name, columns) + +public fun Grouped.sum(vararg columns: String, name: String? = null): DataFrame = + sum(name) { columns.toNumberColumns() } + +public fun Grouped.sum(vararg columns: ColumnReference, name: String? = null): DataFrame = + sum(name) { columns.toColumnSet() } + +public fun Grouped.sum(vararg columns: KProperty, name: String? = null): DataFrame = + sum(name) { columns.toColumnSet() } + +public inline fun Grouped.sumOf( + resultName: String? = null, + crossinline expression: RowExpression, +): DataFrame = Aggregators.sum.aggregateOf(this, resultName, expression) + +// endregion + +// region Pivot + +public fun Pivot.sum(separate: Boolean = false): DataRow = sumFor(separate, numberColumns()) + +public fun Pivot.sumFor( + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataRow = delegate { sumFor(separate, columns) } + +public fun Pivot.sumFor(vararg columns: String, separate: Boolean = false): DataRow = + sumFor(separate) { columns.toNumberColumns() } + +public fun Pivot.sumFor( + vararg columns: ColumnReference, + separate: Boolean = false, +): DataRow = sumFor(separate) { columns.toColumnSet() } + +public fun Pivot.sumFor(vararg columns: KProperty, separate: Boolean = false): DataRow = + sumFor(separate) { columns.toColumnSet() } + +public fun Pivot.sum(columns: ColumnsSelector): DataRow = delegate { sum(columns) } + +public fun Pivot.sum(vararg columns: String): DataRow = sum { columns.toNumberColumns() } + +public fun Pivot.sum(vararg columns: ColumnReference): DataRow = sum { columns.toColumnSet() } + +public fun Pivot.sum(vararg columns: KProperty): DataRow = sum { columns.toColumnSet() } + +public inline fun Pivot.sumOf(crossinline expression: RowExpression): DataRow = + delegate { sumOf(expression) } + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.sum(separate: Boolean = false): DataFrame = sumFor(separate, numberColumns()) + +public fun PivotGroupBy.sumFor( + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataFrame = Aggregators.sum.aggregateFor(this, separate, columns) + +public fun PivotGroupBy.sumFor(vararg columns: String, separate: Boolean = false): DataFrame = + sumFor(separate) { columns.toNumberColumns() } + +public fun PivotGroupBy.sumFor( + vararg columns: ColumnReference, + separate: Boolean = false, +): DataFrame = sumFor(separate) { columns.toColumnSet() } + +public fun PivotGroupBy.sumFor( + vararg columns: KProperty, + separate: Boolean = false, +): DataFrame = sumFor(separate) { columns.toColumnSet() } + +public fun PivotGroupBy.sum(columns: ColumnsSelector): DataFrame = + Aggregators.sum.aggregateAll(this, columns) + +public fun PivotGroupBy.sum(vararg columns: String): DataFrame = sum { columns.toNumberColumns() } + +public fun PivotGroupBy.sum(vararg columns: ColumnReference): DataFrame = + sum { columns.toColumnSet() } + +public fun PivotGroupBy.sum(vararg columns: KProperty): DataFrame = + sum { columns.toColumnSet() } + +public inline fun PivotGroupBy.sumOf( + crossinline expression: RowExpression, +): DataFrame = Aggregators.sum.aggregateOf(this, expression) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/tail.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/tail.kt new file mode 100644 index 000000000..1228924f4 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/tail.kt @@ -0,0 +1,9 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame + +// region DataFrame + +public fun DataFrame.tail(numRows: Int = 5): DataFrame = takeLast(numRows) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/take.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/take.kt new file mode 100644 index 000000000..2c4d9430e --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/take.kt @@ -0,0 +1,1095 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowFilter +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.size +import org.jetbrains.kotlinx.dataframe.impl.columns.transform +import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle +import org.jetbrains.kotlinx.dataframe.index +import org.jetbrains.kotlinx.dataframe.nrow +import kotlin.reflect.KProperty + +// region DataColumn + +public fun DataColumn.take(n: Int): DataColumn = + when { + n == 0 -> get(emptyList()) + n >= size -> this + else -> get(0 until n) + } + +public fun DataColumn.takeLast(n: Int = 1): DataColumn = drop(size - n) + +// endregion + +// region DataFrame + +/** + * Returns a DataFrame containing first [n] rows. + * + * @throws IllegalArgumentException if [n] is negative. + */ +public fun DataFrame.take(n: Int): DataFrame { + require(n >= 0) { "Requested rows count $n is less than zero." } + return getRows(0 until n.coerceAtMost(nrow)) +} + +/** + * Returns a DataFrame containing last [n] rows. + * + * @throws IllegalArgumentException if [n] is negative. + */ +public fun DataFrame.takeLast(n: Int = 1): DataFrame { + require(n >= 0) { "Requested rows count $n is less than zero." } + return drop((nrow - n).coerceAtLeast(0)) +} + +/** + * Returns a DataFrame containing first rows that satisfy the given [predicate]. + */ +public fun DataFrame.takeWhile(predicate: RowFilter): DataFrame = + firstOrNull { !predicate(it, it) }?.let { take(it.index) } ?: this + +// endregion + +// region ColumnsSelectionDsl + +/** + * ## Take [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface TakeColumnsSelectionDsl { + + /** + * ## Take (Last) (Cols) (While) Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * `number: `[`Int`][Int] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`take`**][ColumnsSelectionDsl.take]`(`[**`Last`**][ColumnsSelectionDsl.takeLast]`)`**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + * `| `[**`take`**][ColumnsSelectionDsl.takeWhile]`(`[**`Last`**][ColumnsSelectionDsl.takeLastWhile]`)`[**`While`**][ColumnsSelectionDsl.takeWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`take`**][ColumnsSelectionDsl.take]`(`[**`Last`**][ColumnSet.takeLast]`)`**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + *     `| `__`.`__[**`take`**][ColumnsSelectionDsl.takeWhile]`(`[**`Last`**][ColumnsSelectionDsl.takeLastWhile]`)`[**`While`**][ColumnsSelectionDsl.takeWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`take`**][ColumnsSelectionDsl.takeCols]`(`[**`Last`**][ColumnsSelectionDsl.takeLastCols]`)`[**`Cols`**][ColumnsSelectionDsl.takeCols]**`(`**[`number`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.NumberDef]**`)`** + * + *     `| `__`.`__[**`take`**][ColumnsSelectionDsl.takeColsWhile]`(`[**`Last`**][ColumnsSelectionDsl.takeLastColsWhile]`)`[**`ColsWhile`**][ColumnsSelectionDsl.takeColsWhile]**` { `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`** + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`take`**][ColumnsSelectionDsl.take]`(`[**`Last`**][ColumnsSelectionDsl.takeLast]`)` */ + public interface PlainDslName + + /** __`.`__[**`take`**][ColumnsSelectionDsl.take]`(`[**`Last`**][ColumnSet.takeLast]`)` */ + public interface ColumnSetName + + /** __`.`__[**`take`**][ColumnsSelectionDsl.takeCols]`(`[**`Last`**][ColumnsSelectionDsl.takeLastCols]`)`[**`Cols`**][ColumnsSelectionDsl.takeCols] */ + public interface ColumnGroupName + + /** [**`take`**][ColumnsSelectionDsl.takeWhile]`(`[**`Last`**][ColumnsSelectionDsl.takeLastWhile]`)`[**`While`**][ColumnsSelectionDsl.takeWhile] */ + public interface PlainDslWhileName + + /** __`.`__[**`take`**][ColumnsSelectionDsl.takeWhile]`(`[**`Last`**][ColumnsSelectionDsl.takeLastWhile]`)`[**`While`**][ColumnsSelectionDsl.takeWhile] */ + public interface ColumnSetWhileName + + /** __`.`__[**`take`**][ColumnsSelectionDsl.takeColsWhile]`(`[**`Last`**][ColumnsSelectionDsl.takeLastColsWhile]`)`[**`ColsWhile`**][ColumnsSelectionDsl.takeColsWhile] */ + public interface ColumnGroupWhileName + } + + // region take + + /** + * ## Take (Cols) + * This takes the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `take` is called `takeCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[take][ColumnSet.take]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[take][ColumnsSelectionDsl.take]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeCols][SingleColumn.takeCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeCols][String.takeCols]`(3) }` + * + * #### Examples for this overload: + * + * + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + private interface CommonTakeFirstDocs + + /** + * ## Take (Cols) + * This takes the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `take` is called `takeCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[take][ColumnSet.take]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[take][ColumnsSelectionDsl.take]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeCols][SingleColumn.takeCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeCols][String.takeCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[take][ColumnSet.take]`(2) }` + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[take][ColumnSet.take]`(2) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun ColumnSet.take(n: Int): ColumnSet = transform { it.take(n) } + + /** + * ## Take (Cols) + * This takes the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `take` is called `takeCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[take][ColumnSet.take]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[take][ColumnsSelectionDsl.take]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeCols][SingleColumn.takeCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeCols][String.takeCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[take][ColumnsSelectionDsl.take]`(5) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun ColumnsSelectionDsl<*>.take(n: Int): ColumnSet<*> = this.asSingleColumn().takeCols(n) + + /** + * ## Take (Cols) + * This takes the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `take` is called `takeCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[take][ColumnSet.take]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[take][ColumnsSelectionDsl.take]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeCols][SingleColumn.takeCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeCols][String.takeCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[takeCols][SingleColumn.takeCols]`(1) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun SingleColumn>.takeCols(n: Int): ColumnSet<*> = + this.ensureIsColumnGroup().transformSingle { it.cols().take(n) } + + /** + * ## Take (Cols) + * This takes the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `take` is called `takeCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[take][ColumnSet.take]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[take][ColumnsSelectionDsl.take]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeCols][SingleColumn.takeCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeCols][String.takeCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[takeCols][String.takeCols]`(1) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun String.takeCols(n: Int): ColumnSet<*> = columnGroup(this).takeCols(n) + + /** + * ## Take (Cols) + * This takes the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `take` is called `takeCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[take][ColumnSet.take]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[take][ColumnsSelectionDsl.take]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeCols][SingleColumn.takeCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeCols][String.takeCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[takeCols][SingleColumn.takeCols]`(1) }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[takeCols][KProperty.takeCols]`(1) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun KProperty<*>.takeCols(n: Int): ColumnSet<*> = columnGroup(this).takeCols(n) + + /** + * ## Take (Cols) + * This takes the first [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `take` is called `takeCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[take][ColumnSet.take]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[take][ColumnsSelectionDsl.take]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeCols][SingleColumn.takeCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeCols][String.takeCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[takeCols][ColumnPath.takeCols]`(1) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first [n] columns. + */ + public fun ColumnPath.takeCols(n: Int): ColumnSet<*> = columnGroup(this).takeCols(n) + + // endregion + + // region takeLast + + /** + * ## Take Last (Cols) + * This takes the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLast` is called `takeLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[takeLast][ColumnSet.takeLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[takeLast][ColumnsSelectionDsl.takeLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeLastCols][SingleColumn.takeLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeLastCols][String.takeLastCols]`(3) }` + * + * #### Examples for this overload: + * + * + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + private interface CommonTakeLastDocs + + /** + * ## Take Last (Cols) + * This takes the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLast` is called `takeLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[takeLast][ColumnSet.takeLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[takeLast][ColumnsSelectionDsl.takeLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeLastCols][SingleColumn.takeLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeLastCols][String.takeLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[takeLast][ColumnSet.takeLast]`(2) }` + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[takeLast][ColumnSet.takeLast]`(2) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun ColumnSet.takeLast(n: Int = 1): ColumnSet = transform { it.takeLast(n) } + + /** + * ## Take Last (Cols) + * This takes the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLast` is called `takeLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[takeLast][ColumnSet.takeLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[takeLast][ColumnsSelectionDsl.takeLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeLastCols][SingleColumn.takeLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeLastCols][String.takeLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[takeLast][ColumnsSelectionDsl.takeLast]`(5) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun ColumnsSelectionDsl<*>.takeLast(n: Int = 1): ColumnSet<*> = asSingleColumn().takeLastCols(n) + + /** + * ## Take Last (Cols) + * This takes the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLast` is called `takeLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[takeLast][ColumnSet.takeLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[takeLast][ColumnsSelectionDsl.takeLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeLastCols][SingleColumn.takeLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeLastCols][String.takeLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[takeLast][SingleColumn.takeLastCols]`(1) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun SingleColumn>.takeLastCols(n: Int): ColumnSet<*> = + this.ensureIsColumnGroup().transformSingle { it.cols().takeLast(n) } + + /** + * ## Take Last (Cols) + * This takes the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLast` is called `takeLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[takeLast][ColumnSet.takeLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[takeLast][ColumnsSelectionDsl.takeLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeLastCols][SingleColumn.takeLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeLastCols][String.takeLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[takeLastCols][String.takeLastCols]`(1) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun String.takeLastCols(n: Int): ColumnSet<*> = columnGroup(this).takeLastCols(n) + + /** + * ## Take Last (Cols) + * This takes the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLast` is called `takeLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[takeLast][ColumnSet.takeLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[takeLast][ColumnsSelectionDsl.takeLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeLastCols][SingleColumn.takeLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeLastCols][String.takeLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[takeLastCols][SingleColumn.takeLastCols]`(1) }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[takeLastCols][KProperty.takeLastCols]`(1) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun KProperty<*>.takeLastCols(n: Int): ColumnSet<*> = columnGroup(this).takeLastCols(n) + + /** + * ## Take Last (Cols) + * This takes the last [n] columns from [this] collecting + * the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLast` is called `takeLastCols` when called on + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Grammar] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[in][String.contains]` it.`[name][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[takeLast][ColumnSet.takeLast]`(5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[takeLast][ColumnsSelectionDsl.takeLast]`(1) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[takeLastCols][SingleColumn.takeLastCols]`(2) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[takeLastCols][String.takeLastCols]`(3) }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[takeLastCols][ColumnPath.takeLastCols]`(1) }` + * + * @param [n] The number of columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last [n] columns. + */ + public fun ColumnPath.takeLastCols(n: Int): ColumnSet<*> = columnGroup(this).takeLastCols(n) + + // endregion + + // region takeWhile + + /** + * ## Take (Cols) While + * This function takes the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeWhile` is called + * `takeColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeWhile`][ColumnSet.takeWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeWhile`][SingleColumn.takeColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeColsWhile`][String.takeColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + private interface CommonTakeFirstWhileDocs + + /** + * ## Take (Cols) While + * This function takes the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeWhile` is called + * `takeColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeWhile`][ColumnSet.takeWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeWhile`][SingleColumn.takeColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeColsWhile`][String.takeColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[takeWhile][ColumnSet.takeWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[takeWhile][ColumnSet.takeWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun ColumnSet.takeWhile(predicate: ColumnFilter): ColumnSet = + transform { it.takeWhile(predicate) } + + /** + * ## Take (Cols) While + * This function takes the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeWhile` is called + * `takeColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeWhile`][ColumnSet.takeWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeWhile`][SingleColumn.takeColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeColsWhile`][String.takeColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[takeWhile][ColumnsSelectionDsl.takeWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun ColumnsSelectionDsl<*>.takeWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + asSingleColumn().takeColsWhile(predicate) + + /** + * ## Take (Cols) While + * This function takes the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeWhile` is called + * `takeColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeWhile`][ColumnSet.takeWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeWhile`][SingleColumn.takeColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeColsWhile`][String.takeColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[takeWhile][SingleColumn.takeColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun SingleColumn>.takeColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + this.ensureIsColumnGroup().transformSingle { it.cols().takeWhile(predicate) } + + /** + * ## Take (Cols) While + * This function takes the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeWhile` is called + * `takeColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeWhile`][ColumnSet.takeWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeWhile`][SingleColumn.takeColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeColsWhile`][String.takeColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[takeColsWhile][String.takeColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun String.takeColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).takeColsWhile(predicate) + + /** + * ## Take (Cols) While + * This function takes the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeWhile` is called + * `takeColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeWhile`][ColumnSet.takeWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeWhile`][SingleColumn.takeColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeColsWhile`][String.takeColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[takeColsWhile][SingleColumn.takeColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[takeColsWhile][KProperty.takeColsWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun KProperty<*>.takeColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).takeColsWhile(predicate) + + /** + * ## Take (Cols) While + * This function takes the first columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeWhile` is called + * `takeColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeWhile`][ColumnSet.takeWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeWhile`][SingleColumn.takeColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeColsWhile`][String.takeColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[takeColsWhile][ColumnPath.takeColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the first columns adhering to the [predicate]. + */ + public fun ColumnPath.takeColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).takeColsWhile(predicate) + + // endregion + + // region takeLastWhile + + /** + * ## Take Last (Cols) While + * This function takes the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLastWhile` is called + * `takeLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeLastWhile`][ColumnSet.takeLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeLastWhile`][SingleColumn.takeLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeLastColsWhile`][String.takeLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + private interface CommonTakeLastWhileDocs + + /** + * ## Take Last (Cols) While + * This function takes the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLastWhile` is called + * `takeLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeLastWhile`][ColumnSet.takeLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeLastWhile`][SingleColumn.takeLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeLastColsWhile`][String.takeLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[takeLastWhile][ColumnSet.takeLastWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { .. }.`[takeLastWhile][ColumnSet.takeLastWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun ColumnSet.takeLastWhile(predicate: ColumnFilter): ColumnSet = + transform { it.takeLastWhile(predicate) } + + /** + * ## Take Last (Cols) While + * This function takes the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLastWhile` is called + * `takeLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeLastWhile`][ColumnSet.takeLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeLastWhile`][SingleColumn.takeLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeLastColsWhile`][String.takeLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[takeLastWhile][ColumnsSelectionDsl.takeLastWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun ColumnsSelectionDsl<*>.takeLastWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + asSingleColumn().takeLastColsWhile(predicate) + + /** + * ## Take Last (Cols) While + * This function takes the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLastWhile` is called + * `takeLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeLastWhile`][ColumnSet.takeLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeLastWhile`][SingleColumn.takeLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeLastColsWhile`][String.takeLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[takeLastColsWhile][SingleColumn.takeLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun SingleColumn>.takeLastColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + this.ensureIsColumnGroup().transformSingle { it.cols().takeLastWhile(predicate) } + + /** + * ## Take Last (Cols) While + * This function takes the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLastWhile` is called + * `takeLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeLastWhile`][ColumnSet.takeLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeLastWhile`][SingleColumn.takeLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeLastColsWhile`][String.takeLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[takeLastColsWhile][String.takeLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun String.takeLastColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).takeLastColsWhile(predicate) + + /** + * ## Take Last (Cols) While + * This function takes the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLastWhile` is called + * `takeLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeLastWhile`][ColumnSet.takeLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeLastWhile`][SingleColumn.takeLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeLastColsWhile`][String.takeLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[takeLastColsWhile][SingleColumn.takeLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[takeLastColsWhile][KProperty.takeLastColsWhile]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun KProperty<*>.takeLastColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).takeLastColsWhile(predicate) + + /** + * ## Take Last (Cols) While + * This function takes the last columns from [this] adhering to the + * given [predicate] collecting the result into a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]. + * + * This function operates solely on columns at the top-level. + * + * Any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be used as receiver for these functions. + * + * NOTE: To avoid ambiguity, `takeLastWhile` is called + * `takeLastColsWhile` when called on a [String] or [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] resembling + * a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + * ### Check out: [Usage] + * + * #### Examples: + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[`cols`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` }.`[`takeLastWhile`][ColumnSet.takeLastWhile]` { "my" `[`in`][String.contains]` it.`[`name`][org.jetbrains.kotlinx.dataframe.DataColumn.name]` } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[`takeLastWhile`][SingleColumn.takeLastColsWhile]` { it.`[`any`][org.jetbrains.kotlinx.dataframe.DataColumn.any]` { it == "Alice" } } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[`takeLastColsWhile`][String.takeLastColsWhile]` { it.`[`kind`][org.jetbrains.kotlinx.dataframe.DataColumn.kind]`() == `[`ColumnKind.Value`][org.jetbrains.kotlinx.dataframe.columns.ColumnKind.Value]` } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[takeLastColsWhile][ColumnPath.takeLastColsWhile]` { it.`[name][ColumnWithPath.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [predicate] The [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] to control which columns to take. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the last columns adhering to the [predicate]. + */ + public fun ColumnPath.takeLastColsWhile(predicate: ColumnFilter<*>): ColumnSet<*> = + columnGroup(this).takeLastColsWhile(predicate) + + // endregion +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt new file mode 100644 index 000000000..cdc56fccb --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt @@ -0,0 +1,332 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyBaseCol +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.annotations.DataSchema +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.impl.ColumnNameGenerator +import org.jetbrains.kotlinx.dataframe.impl.api.createDataFrameImpl +import org.jetbrains.kotlinx.dataframe.impl.asList +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType +import org.jetbrains.kotlinx.dataframe.index +import kotlin.reflect.KCallable +import kotlin.reflect.KClass +import kotlin.reflect.KProperty + +// region read DataFrame from objects + +@Refine +@Interpretable("toDataFrameDefault") +public inline fun Iterable.toDataFrame(): DataFrame = + toDataFrame { + properties() + } + +@Refine +@Interpretable("toDataFrameDsl") +public inline fun Iterable.toDataFrame(noinline body: CreateDataFrameDsl.() -> Unit): DataFrame = + createDataFrameImpl(T::class, body) + +@Refine +@Interpretable("toDataFrame") +public inline fun Iterable.toDataFrame(vararg props: KProperty<*>, maxDepth: Int = 0): DataFrame = + toDataFrame { + properties(roots = props, maxDepth = maxDepth) + } + +@JvmName("toDataFrameT") +public fun Iterable>.toDataFrame(): DataFrame { + var uniqueDf: DataFrame? = null + for (row in this) { + if (uniqueDf == null) { + uniqueDf = row.df() + } else { + if (uniqueDf !== row.df()) { + uniqueDf = null + break + } + } + } + return if (uniqueDf != null) { + val permutation = map { it.index } + uniqueDf[permutation] + } else { + map { it.toDataFrame() }.concat() + } +} + +@JvmName("toDataFrameAnyColumn") +public fun Iterable.toDataFrame(): AnyFrame = dataFrameOf(this) + +@JvmName("toDataFramePairColumnPathAnyCol") +public fun Iterable>.toDataFrameFromPairs(): DataFrame { + val nameGenerator = ColumnNameGenerator() + val columnNames = mutableListOf() + val columnGroups = mutableListOf>?>() + val columns = mutableListOf() + val columnIndices = mutableMapOf() + val columnGroupName = mutableMapOf() + + forEach { (path, col) -> + when (path.size) { + 0 -> { + } + + 1 -> { + val name = path[0] + val uniqueName = nameGenerator.addUnique(name) + val index = columns.size + columnNames.add(uniqueName) + columnGroups.add(null) + columns.add(col.rename(uniqueName)) + columnIndices[uniqueName] = index + } + + else -> { + val name = path[0] + val uniqueName = columnGroupName.getOrPut(name) { + nameGenerator.addUnique(name) + } + val index = columnIndices.getOrPut(uniqueName) { + columnNames.add(uniqueName) + columnGroups.add(mutableListOf()) + columns.add(null) + columns.size - 1 + } + val list = columnGroups[index]!! + list.add(path.drop(1) to col) + } + } + } + columns.indices.forEach { index -> + val group = columnGroups[index] + if (group != null) { + val nestedDf = group.toDataFrameFromPairs() + val col = DataColumn.createColumnGroup(columnNames[index], nestedDf) + assert(columns[index] == null) + columns[index] = col + } else { + assert(columns[index] != null) + } + } + return columns.map { it!! }.toDataFrame().cast() +} + +@JvmName("toDataFrameColumnPathAnyNullable") +public fun Iterable>>.toDataFrameFromPairs(): AnyFrame = + map { + it.first to guessColumnType(it.first.last(), it.second.asList()) + }.toDataFrameFromPairs() + +public fun Iterable>>.toDataFrameFromPairs(): AnyFrame = + map { + ColumnPath(it.first) to guessColumnType(it.first, it.second.asList()) + }.toDataFrameFromPairs() + +public interface TraversePropertiesDsl { + + /** + * Skip given [classes] during recursive (dfs) traversal. + */ + @Interpretable("Exclude0") + public fun exclude(vararg classes: KClass<*>) + + /** + * Skip given [properties] during recursive (dfs) traversal. + * These can also be getter-like functions (like `getX()` or `isX()`). + */ + @Interpretable("Exclude1") + public fun exclude(vararg properties: KCallable<*>) + + /** + * Store given [classes] in ValueColumns without transformation into ColumnGroups or FrameColumns. + */ + @Interpretable("Preserve0") + public fun preserve(vararg classes: KClass<*>) + + /** + * Store given [properties] in ValueColumns without transformation into ColumnGroups or FrameColumns. + * These can also be getter-like functions (like `getX()` or `isX()`). + */ + @Interpretable("Preserve1") + public fun preserve(vararg properties: KCallable<*>) +} + +public inline fun TraversePropertiesDsl.preserve(): Unit = preserve(T::class) + +public abstract class CreateDataFrameDsl : TraversePropertiesDsl { + + public abstract val source: Iterable + + public abstract fun add(column: AnyBaseCol, path: ColumnPath? = null) + + public infix fun AnyBaseCol.into(name: String): Unit = add(this, pathOf(name)) + + public infix fun AnyBaseCol.into(path: ColumnPath): Unit = add(this, path) + + @Interpretable("Properties0") + public abstract fun properties( + vararg roots: KCallable<*>, + maxDepth: Int = 0, + body: (TraversePropertiesDsl.() -> Unit)? = null, + ) + + public inline fun expr(infer: Infer = Infer.Nulls, noinline expression: (T) -> R): DataColumn = + source.map { expression(it) }.toColumn(infer = infer) + + public inline fun add(name: String, noinline expression: (T) -> R): Unit = + add(source.map { expression(it) }.toColumn(name, Infer.Nulls)) + + @Interpretable("ToDataFrameFrom0") + public inline infix fun String.from(noinline expression: (T) -> R): Unit = add(this, expression) + + public inline infix fun KProperty.from(noinline expression: (T) -> R): Unit = + add(columnName, expression) + + public inline infix fun String.from(inferType: InferType): Unit = + add(DataColumn.createWithTypeInference(this, source.map { inferType.expression(it) })) + + public inline infix fun KProperty.from(inferType: InferType): Unit = + add(DataColumn.createWithTypeInference(columnName, source.map { inferType.expression(it) })) + + public data class InferType(val expression: (T) -> R) + + public inline fun inferType(noinline expression: (T) -> R): InferType = InferType(expression) + + public abstract operator fun String.invoke(builder: CreateDataFrameDsl.() -> Unit) +} + +@Refine +@Interpretable("ToDataFrameColumn") +public inline fun Iterable.toDataFrame(columnName: String): DataFrame<*> = + toDataFrame { + columnName from { it } + } + +// endregion + +// region toDataFrame overloads for built-in types + +/* +Without overloads Iterable.toDataFrame produces unexpected result + + +``` +val string = listOf("aaa", "aa", null) +string.toDataFrame() +``` +=> + length +0 3 +1 2 +2 null + */ + +@JvmName("toDataFrameByte") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameShort") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameInt") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameLong") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameString") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameChar") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameBoolean") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameFloat") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameDouble") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameUByte") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameUShort") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameUInt") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@JvmName("toDataFrameULong") +public inline fun Iterable.toDataFrame(): DataFrame> = + toDataFrame { + ValueProperty::value from { it } + }.cast() + +@DataSchema +public interface ValueProperty { + public val value: T +} + +// endregion + +// region Create DataFrame from Map + +public fun Map>.toDataFrame(): AnyFrame = + map { + DataColumn.createWithTypeInference(it.key, it.value.asList()) + }.toDataFrame() + +@JvmName("toDataFrameColumnPathAnyNullable") +public fun Map>.toDataFrame(): AnyFrame = + map { + it.key to DataColumn.createWithTypeInference( + name = it.key.last(), + values = it.value.asList(), + ) + }.toDataFrameFromPairs() + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toList.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toList.kt new file mode 100644 index 000000000..b9eb5a873 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toList.kt @@ -0,0 +1,14 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.impl.api.toListImpl +import kotlin.reflect.typeOf + +// region DataFrame + +public inline fun DataFrame.toList(): List = toListImpl(typeOf()) as List + +public inline fun AnyFrame.toListOf(): List = toListImpl(typeOf()) as List + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/transpose.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/transpose.kt new file mode 100644 index 000000000..774bea2f7 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/transpose.kt @@ -0,0 +1,32 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.impl.api.convertTo +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.owner +import org.jetbrains.kotlinx.dataframe.values +import kotlin.reflect.KType +import kotlin.reflect.typeOf + +// region DataRow + +public fun DataRow.transpose(): DataFrame> { + val valueColumn = DataColumn.createWithTypeInference(NameValuePair<*>::value.columnName, values) + val nameColumn = owner.columnNames().toValueColumn(NameValuePair<*>::name) + return dataFrameOf(nameColumn, valueColumn).cast() +} + +public inline fun AnyRow.transposeTo(): DataFrame> = transposeTo(typeOf()) + +@PublishedApi +internal fun AnyRow.transposeTo(type: KType): DataFrame> { + val convertedValues = values.map { it?.convertTo(type) as T? } + val valueColumn = DataColumn.createWithTypeInference(NameValuePair::value.columnName, convertedValues) + val nameColumn = owner.columnNames().toValueColumn(NameValuePair::name) + return dataFrameOf(nameColumn, valueColumn).cast() +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/unfold.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/unfold.kt new file mode 100644 index 000000000..837154cce --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/unfold.kt @@ -0,0 +1,34 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.columns.ColumnKind +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.createDataFrameImpl +import org.jetbrains.kotlinx.dataframe.typeClass +import kotlin.reflect.KProperty + +public inline fun DataColumn.unfold(): AnyCol = + when (kind()) { + ColumnKind.Group, ColumnKind.Frame -> this + + else -> when { + isPrimitive() -> this + + else -> values() + .createDataFrameImpl(typeClass) { (this as CreateDataFrameDsl).properties() } + .asColumnGroup(name()) + .asDataColumn() + } + } + +public fun DataFrame.unfold(columns: ColumnsSelector): DataFrame = replace(columns).with { it.unfold() } + +public fun DataFrame.unfold(vararg columns: String): DataFrame = unfold { columns.toColumnSet() } + +public fun DataFrame.unfold(vararg columns: AnyColumnReference): DataFrame = unfold { columns.toColumnSet() } + +public fun DataFrame.unfold(vararg columns: KProperty<*>): DataFrame = unfold { columns.toColumnSet() } diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ungroup.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ungroup.kt new file mode 100644 index 000000000..8f0311c53 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ungroup.kt @@ -0,0 +1,28 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.removeAt +import kotlin.reflect.KProperty + +// region DataFrame + +@Refine +@Interpretable("Ungroup0") +public fun DataFrame.ungroup(columns: ColumnsSelector): DataFrame = + move { columns.toColumnSet().colsInGroups() } + .into { it.path.removeAt(it.path.size - 2).toPath() } + +public fun DataFrame.ungroup(vararg columns: String): DataFrame = ungroup { columns.toColumnSet() } + +public fun DataFrame.ungroup(vararg columns: AnyColumnReference): DataFrame = + ungroup { columns.toColumnSet() } + +public fun DataFrame.ungroup(vararg columns: KProperty<*>): DataFrame = ungroup { columns.toColumnSet() } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/update.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/update.kt new file mode 100644 index 000000000..7c483713b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/update.kt @@ -0,0 +1,772 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnExpression +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataFrameExpression +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowColumnExpression +import org.jetbrains.kotlinx.dataframe.RowValueFilter +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.api.Update.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenColumn +import org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenDataFrame +import org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow +import org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRowAndColumn +import org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns +import org.jetbrains.kotlinx.dataframe.documentation.SelectingRows +import org.jetbrains.kotlinx.dataframe.impl.api.asFrameImpl +import org.jetbrains.kotlinx.dataframe.impl.api.updateImpl +import org.jetbrains.kotlinx.dataframe.impl.api.updateWithValuePerColumnImpl +import org.jetbrains.kotlinx.dataframe.impl.headPlusArray +import org.jetbrains.kotlinx.dataframe.index +import kotlin.reflect.KProperty + +/** + * ## The Update Operation + * + * Returns the [DataFrame] with changed values in some cells + * (column types cannot be changed). + * + * ### Check out: [Grammar] + * + * For more information: [See `update` on the documentation website.](https://kotlin.github.io/dataframe/update.html) + */ +public class Update( + internal val df: DataFrame, + internal val filter: RowValueFilter?, + internal val columns: ColumnsSelector, +) { + public fun cast(): Update = + Update(df, filter as RowValueFilter?, columns as ColumnsSelector) + + override fun toString(): String = "Update(df=$df, filter=$filter, columns=$columns)" + + /** + * ## [**`update`**][update] Operation Grammar + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + * + *      + * + * + * [**`update`**][update]**` { `**[`columns`][SelectingColumns]**` }`** + * + *      + * `[ `__`.`__[**`where`**][Update.where]**` { `**[`rowValueCondition`][SelectingRows.RowValueCondition.WithExample]**` } `**`]` + * + *      + * `[ `__`.`__[**`at`**][Update.at]**`(`**[`rowIndices`][CommonUpdateAtFunctionDoc.RowIndicesParam]**`)`**` ]` + * + *      + * __`.`__[**`with`**][Update.with]**` { `**[`rowExpression`][ExpressionsGivenRow.RowValueExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`notNull`**][Update.notNull]**` { `**[`rowExpression`][ExpressionsGivenRow.RowValueExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`perCol`**][Update.perCol]**` { `**[`colExpression`][ExpressionsGivenColumn.ColumnExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`perRowCol`**][Update.perRowCol]**` { `**[`rowColExpression`][ExpressionsGivenRowAndColumn.RowColumnExpression.WithExample]**` }`** + * + *      + * `| `__`.`__[**`withNull`**][Update.withNull]**`()`** + * + *      + * `| `__`.`__[**`withZero`**][Update.withZero]**`()`** + * + *      + * `| `__`.`__[**`asFrame`**][Update.asFrame]**` { `**[`dataFrameExpression`][ExpressionsGivenDataFrame.DataFrameExpression.WithExample]**` }`** + * + * + */ + public interface Grammar + + /** + * The columns to update need to be selected. See [Selecting Columns][UpdateSelectingOptions] + * for all the selecting options. + */ + public interface Columns { + + // Optional argument that can be set to redirect where the [Selecting Columns] link points to + public interface SelectingColumnsArg + } + + /** + * + * ## Selecting Columns + * Selecting columns for various operations (including but not limited to + * [DataFrame.select][org.jetbrains.kotlinx.dataframe.DataFrame.select], [DataFrame.update][org.jetbrains.kotlinx.dataframe.DataFrame.update], [DataFrame.gather][org.jetbrains.kotlinx.dataframe.DataFrame.gather], and [DataFrame.fillNulls][org.jetbrains.kotlinx.dataframe.DataFrame.fillNulls]) + * can be done in the following ways: + * ### 1. [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.Dsl.WithExample] + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * #### NOTE: There's also a 'single column' variant used sometimes: [Column Selection DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.DslSingle.WithExample]. + * ### 2. [Column names][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnNames.WithExample] + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`("length", "age")` + * + * ### 3. [Column references][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnAccessors.WithExample] + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`(length, age)` + * + * ### 4. [KProperties][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.KProperties.WithExample] + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`(Person::length, Person::age)` + * + */ + public interface UpdateSelectingOptions + + /** @param [columns] The [Columns Selector][ColumnsSelector] used to select the columns of this [DataFrame] to update. */ + internal interface DslParam + + /** @param [columns] The [Column References][ColumnReference] of this [DataFrame] to update. */ + internal interface ColumnAccessorsParam + + /** @param [columns] The [KProperties][KProperty] corresponding to columns of this [DataFrame] to update. */ + internal interface KPropertiesParam + + /** @param [columns] The [Strings][String] corresponding to the names of columns belonging to this [DataFrame] to update. */ + internal interface ColumnNamesParam +} + +// region update + +/** + * ## The Update Operation + * + * Returns the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with changed values in some cells + * (column types cannot be changed). + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.Update.Grammar] + * + * For more information: [See `update` on the documentation website.](https://kotlin.github.io/dataframe/update.html) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Update.UpdateSelectingOptions] + * for all the selecting options. + * ### This Update Overload + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * @param [columns] The [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] used to select the columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +@Interpretable("Update0") +public fun DataFrame.update(columns: ColumnsSelector): Update = Update(this, null, columns) + +/** + * ## The Update Operation + * + * Returns the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with changed values in some cells + * (column types cannot be changed). + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.Update.Grammar] + * + * For more information: [See `update` on the documentation website.](https://kotlin.github.io/dataframe/update.html) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Update.UpdateSelectingOptions] + * for all the selecting options. + * ### This Update Overload + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`("length", "age")` + * + * ## Optional + * Combine `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`(...).`[with][org.jetbrains.kotlinx.dataframe.api.Update.with]` { ... }` + * into `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`(...) { ... }` + * @param [columns] The [Strings][String] corresponding to the names of columns belonging to this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.update(vararg columns: String): Update = update { columns.toColumnSet() } + +/** + * ## The Update Operation + * + * Returns the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with changed values in some cells + * (column types cannot be changed). + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.Update.Grammar] + * + * For more information: [See `update` on the documentation website.](https://kotlin.github.io/dataframe/update.html) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Update.UpdateSelectingOptions] + * for all the selecting options. + * ### This Update Overload + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`(Person::length, Person::age)` + * + * ## Optional + * Combine `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`(...).`[with][org.jetbrains.kotlinx.dataframe.api.Update.with]` { ... }` + * into `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`(...) { ... }` + * @param [columns] The [KProperties][KProperty] corresponding to columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.update(vararg columns: KProperty): Update = update { columns.toColumnSet() } + +/** + * ## The Update Operation + * + * Returns the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with changed values in some cells + * (column types cannot be changed). + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.Update.Grammar] + * + * For more information: [See `update` on the documentation website.](https://kotlin.github.io/dataframe/update.html) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Update.UpdateSelectingOptions] + * for all the selecting options. + * ### This Update Overload + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`(length, age)` + * + * ## Optional + * Combine `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`(...).`[with][org.jetbrains.kotlinx.dataframe.api.Update.with]` { ... }` + * into `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]`(...) { ... }` + * @param [columns] The [Column References][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + */ +public fun DataFrame.update(vararg columns: ColumnReference): Update = + update { columns.toColumnSet() } + +// endregion + +/** ## Where + * Filter or find rows to operate on after [selecting columns][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns] using a + * [row value filter][org.jetbrains.kotlinx.dataframe.RowValueFilter]. + * + * For example: + * + * `df.`[update][update]` { length }.`[where][where]` { it > 10.0 }` + * + * `df.`[update][update]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }.`[where][where]` { `[index][org.jetbrains.kotlinx.dataframe.index]`() > 4 && city != "Paris" }` + * + * + * + * + * @param [predicate] The [row value filter][RowValueFilter] to select the rows to update. + */ +public fun Update.where(predicate: RowValueFilter): Update = + Update(df = df, filter = filter and predicate, columns = columns) + +/** + * ## At + * Only update the columns at certain given [row indices][org.jetbrains.kotlinx.dataframe.api.CommonUpdateAtFunctionDoc.RowIndicesParam]: + * + * Either a [Collection]<[Int]>, an [IntRange], or just `vararg` indices. + * + * For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { city }.`[at][org.jetbrains.kotlinx.dataframe.api.at]`(5..10).`[with][org.jetbrains.kotlinx.dataframe.api.with]` { "Paris" }` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { name }.`[at][org.jetbrains.kotlinx.dataframe.api.at]`(1, 2, 3, 4).`[with][org.jetbrains.kotlinx.dataframe.api.with]` { "Empty" }` + * + * ### This At Overload + * + * Provide a [Collection]<[Int]> of row indices to update. + * + * @param [rowIndices] The indices of the rows to update. Either a [Collection]<[Int]>, an [IntRange], or just `vararg` indices. + */ +public fun Update.at(rowIndices: Collection): Update = where { index in rowIndices } + +/** + * ## At + * Only update the columns at certain given [row indices][org.jetbrains.kotlinx.dataframe.api.CommonUpdateAtFunctionDoc.RowIndicesParam]: + * + * Either a [Collection]<[Int]>, an [IntRange], or just `vararg` indices. + * + * For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { city }.`[at][org.jetbrains.kotlinx.dataframe.api.at]`(5..10).`[with][org.jetbrains.kotlinx.dataframe.api.with]` { "Paris" }` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { name }.`[at][org.jetbrains.kotlinx.dataframe.api.at]`(1, 2, 3, 4).`[with][org.jetbrains.kotlinx.dataframe.api.with]` { "Empty" }` + * + * ### This At Overload + * + * Provide a `vararg` of [Ints][Int] of row indices to update. + * + * @param [rowIndices] The indices of the rows to update. Either a [Collection]<[Int]>, an [IntRange], or just `vararg` indices. + */ +public fun Update.at(vararg rowIndices: Int): Update = at(rowIndices.toSet()) + +/** + * ## At + * Only update the columns at certain given [row indices][org.jetbrains.kotlinx.dataframe.api.CommonUpdateAtFunctionDoc.RowIndicesParam]: + * + * Either a [Collection]<[Int]>, an [IntRange], or just `vararg` indices. + * + * For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { city }.`[at][org.jetbrains.kotlinx.dataframe.api.at]`(5..10).`[with][org.jetbrains.kotlinx.dataframe.api.with]` { "Paris" }` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { name }.`[at][org.jetbrains.kotlinx.dataframe.api.at]`(1, 2, 3, 4).`[with][org.jetbrains.kotlinx.dataframe.api.with]` { "Empty" }` + * + * ### This At Overload + * + * Provide an [IntRange] of row indices to update. + * + * @param [rowRange] The indices of the rows to update. Either a [Collection]<[Int]>, an [IntRange], or just `vararg` indices. + */ +public fun Update.at(rowRange: IntRange): Update = where { index in rowRange } + +/** ## Per Row Col + * Provide a new value for every selected cell given both its row and column using a [row-column expression][org.jetbrains.kotlinx.dataframe.RowColumnExpression]. + * + * For example: + * + * `df.`[update][update]` { age }.`[perRowCol][perRowCol]` { row, col ->` + * + *     `row.age / col.`[mean][org.jetbrains.kotlinx.dataframe.DataColumn.mean]`(skipNA = true)` + * + * `}` + * + * + * + * + * ## See Also + * - [Update with][org.jetbrains.kotlinx.dataframe.api.Update.with] to provide a new value for every selected cell giving its row. + * - [Update per col][org.jetbrains.kotlinx.dataframe.api.Update.perCol] to provide a new value for every selected cell giving its column. + * @param [expression] The [Row Column Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRowAndColumn.RowColumnExpression] to provide a new value for every selected cell giving its row and column. + */ +public fun Update.perRowCol(expression: RowColumnExpression): DataFrame = + updateImpl { row, column, _ -> expression(row, column) } + +/** + * ## Update Expression + * @see ExpressionsGivenRow.RowValueExpression.WithExample + * @see ExpressionsGivenRow.AddDataRowNote + */ +public typealias UpdateExpression = AddDataRow.(C) -> R + +/** ## With + * Provide a new value for every selected cell given its row and its previous value using a + * [row value expression][org.jetbrains.kotlinx.dataframe.RowValueExpression]. + * + * For example: + * + * `df.`[update][update]` { city }.`[with][with]` { name.firstName + " from " + it }` + * + * `df.`[update][update]` { city }.`[with][with]` { it.uppercase() }` + * + * + * + * ## Note + * [update with][org.jetbrains.kotlinx.dataframe.api.Update.with]- and [add][org.jetbrains.kotlinx.dataframe.api.add]-like expressions use [AddDataRow][org.jetbrains.kotlinx.dataframe.api.AddDataRow] instead of [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as the DSL's receiver type. + * This is an extension to [RowValueExpression][org.jetbrains.kotlinx.dataframe.RowValueExpression] and + * [RowExpression][org.jetbrains.kotlinx.dataframe.RowExpression] that provides access to + * the modified/generated value of the preceding row ([AddDataRow.newValue][org.jetbrains.kotlinx.dataframe.api.AddDataRow.newValue]). + * ## See Also + * - [Update per col][org.jetbrains.kotlinx.dataframe.api.Update.perCol] to provide a new value for every selected cell giving its column. + * - [Update per row col][org.jetbrains.kotlinx.dataframe.api.Update.perRowCol] to provide a new value for every selected cell giving its row and column. + * @param [expression] The [Row Value Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowValueExpression.WithExample] to update the rows with. + */ +@Refine +@Interpretable("UpdateWith0") +public fun Update.with(expression: UpdateExpression): DataFrame = + updateImpl { row, _, value -> + expression(row, value) + } + +/** ## As Frame + * + * Updates selected [column group][ColumnGroup] as a [DataFrame] with the given [expression]. + * + * Provide a new value for every selected data frame using a [dataframe expression][org.jetbrains.kotlinx.dataframe.DataFrameExpression]. + * + * For example: + * + * `df.`[update][update]` { name }.`[asFrame][asFrame]` { `[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { lastName } }` + * + * @param [expression] The [Data Frame Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenDataFrame.DataFrameExpression] to replace the selected column group with. + */ +public fun Update>.asFrame(expression: DataFrameExpression>): DataFrame = + asFrameImpl(expression) + +/** + * ## Per Col + * + * Per Col can be used for two different types of operations: + * - Provide a new value for every selected cell given its column using a [column expression][org.jetbrains.kotlinx.dataframe.ColumnExpression]. + * - Provide a new value for every selected cell per column using a [Map][Map]`<`[colName: String][String]`, value: C>` + * or [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as Map. + * + * ### See Also + * - [Update with][org.jetbrains.kotlinx.dataframe.api.Update.with] to provide a new value for every selected cell giving its row. + * - [Update per row col][org.jetbrains.kotlinx.dataframe.api.Update.perRowCol] to provide a new value for every selected cell giving its row and column. + * ### This Per Col Overload + * Provide a new value for every selected cell per column using a [Map][Map]`<`[colName: String][String]`, value: C>` + * or [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as Map. + * + * For example: + * + * `val defaults = `[mapOf][mapOf]`("name" to "Empty", "age" to 0)` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { name and age }.`[where][org.jetbrains.kotlinx.dataframe.api.Update.where]` { ... }.`[perCol][org.jetbrains.kotlinx.dataframe.api.perCol]`(defaults)` + * + * @throws [IllegalArgumentException] if a value for a selected cell's column is not defined in [values]. + * + * + * @param [values] The [Map]<[String], Value> to provide a new value for every selected cell. + * For each selected column, there must be a value in the map with the same name. + */ +public fun Update.perCol(values: Map): DataFrame = + updateWithValuePerColumnImpl { + values[it.name()] ?: throw IllegalArgumentException("Update value for column ${it.name()} is not defined") + } + +/** + * ## Per Col + * + * Per Col can be used for two different types of operations: + * - Provide a new value for every selected cell given its column using a [column expression][org.jetbrains.kotlinx.dataframe.ColumnExpression]. + * - Provide a new value for every selected cell per column using a [Map][Map]`<`[colName: String][String]`, value: C>` + * or [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as Map. + * + * ### See Also + * - [Update with][org.jetbrains.kotlinx.dataframe.api.Update.with] to provide a new value for every selected cell giving its row. + * - [Update per row col][org.jetbrains.kotlinx.dataframe.api.Update.perRowCol] to provide a new value for every selected cell giving its row and column. + * ### This Per Col Overload + * Provide a new value for every selected cell per column using a [Map][Map]`<`[colName: String][String]`, value: C>` + * or [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as Map. + * + * For example: + * + * `val defaults = df.`[getRows][DataFrame.getRows]`(`[listOf][listOf]`(0))` + * + *     `.`[update][update]` { name }.`[with][Update.with]` { "Empty" }` + * + *     `.`[update][update]` { age }.`[with][Update.with]` { 0 }` + * + *     `.first()` + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { name and age }.`[where][org.jetbrains.kotlinx.dataframe.api.Update.where]` { ... }.`[perCol][org.jetbrains.kotlinx.dataframe.api.perCol]`(defaults)` + * + * @throws [IllegalArgumentException] if a value for a selected cell's column is not defined in [values]. + * + * + * @param [values] The [DataRow] to provide a new value for every selected cell. + */ +public fun Update.perCol(values: AnyRow): DataFrame = perCol(values.toMap() as Map) + +/** + * ## Per Col + * + * Per Col can be used for two different types of operations: + * - Provide a new value for every selected cell given its column using a [column expression][org.jetbrains.kotlinx.dataframe.ColumnExpression]. + * - Provide a new value for every selected cell per column using a [Map][Map]`<`[colName: String][String]`, value: C>` + * or [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as Map. + * + * ### See Also + * - [Update with][org.jetbrains.kotlinx.dataframe.api.Update.with] to provide a new value for every selected cell giving its row. + * - [Update per row col][org.jetbrains.kotlinx.dataframe.api.Update.perRowCol] to provide a new value for every selected cell giving its row and column. + * ### This Per Col Overload + * Provide a new value for every selected cell given its column using a [column expression][org.jetbrains.kotlinx.dataframe.ColumnExpression]. + * + * For example: + * + * `df.`[update][update]` { age }.`[perCol][perCol]` { `[mean][org.jetbrains.kotlinx.dataframe.DataColumn.mean]`(skipNA = true) }` + * + * `df.`[update][update]` { age }.`[perCol][perCol]` { `[count][org.jetbrains.kotlinx.dataframe.DataColumn.count]` { it > 10 } }` + * + * + * + * @param [valueSelector] The [Column Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenColumn.ColumnExpression] to provide a new value for every selected cell giving its column. + */ +public fun Update.perCol(valueSelector: ColumnExpression): DataFrame = + updateWithValuePerColumnImpl(valueSelector) + +/** Chains up two row value filters together. */ +internal infix fun RowValueFilter?.and(other: RowValueFilter): RowValueFilter { + if (this == null) return other + val thisExp = this + return { thisExp(this, it) && other(this, it) } +} + +/** ## Not Null + * + * Selects only the rows where the values in the selected columns are not null. + * + * Shorthand for: [update][org.jetbrains.kotlinx.dataframe.api.update]` { ... }.`[where][org.jetbrains.kotlinx.dataframe.api.Update.where]` { it != null }` + * + * For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.colsOf]`<`[Number][Number]`?>() }.`[notNull][org.jetbrains.kotlinx.dataframe.api.notNull]`().`[perCol][org.jetbrains.kotlinx.dataframe.api.Update.perCol]` { `[mean][org.jetbrains.kotlinx.dataframe.api.mean]`() }` + * + * ### Optional + * Provide an [expression] to update the rows with. + * This combines [with][org.jetbrains.kotlinx.dataframe.api.Update.with] with [notNull][org.jetbrains.kotlinx.dataframe.api.notNull]. + * + * For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { city }.`[notNull][org.jetbrains.kotlinx.dataframe.api.Update.notNull]` { it.`[toUpperCase][String.toUpperCase]`() }` + * + * @param expression Optional [Row Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowExpression.WithExample] to update the rows with. */ +public fun Update.notNull(): Update = where { it != null } as Update + +/** + * ## Not Null + * + * Selects only the rows where the values in the selected columns are not null. + * + * Shorthand for: [update][update]` { ... }.`[where][Update.where]` { it != null }` + * + * For example: + * + * `df.`[update][update]` { `[colsOf][colsOf]`<`[Number][Number]`?>() }.`[notNull][notNull]`().`[perCol][Update.perCol]` { `[mean][mean]`() }` + * + * ### Optional + * Provide an [expression] to update the rows with. + * This combines [with][Update.with] with [notNull]. + * + * For example: + * + * `df.`[update][update]` { city }.`[notNull][Update.notNull]` { it.`[toUpperCase][String.toUpperCase]`() }` + * + * @param expression Optional [Row Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowExpression.WithExample] to update the rows with. + */ +public fun Update.notNull(expression: UpdateExpression): DataFrame = + notNull().with(expression) + +/** + * ## The Update Operation + * + * Returns the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with changed values in some cells + * (column types cannot be changed). + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.Update.Grammar] + * + * For more information: [See `update` on the documentation website.](https://kotlin.github.io/dataframe/update.html) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Update.UpdateSelectingOptions] + * for all the selecting options. + * ### This Update Overload + * This overload is a combination of [update] and [with][Update.with]. + * + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * Provide a new value for every selected cell given its row and its previous value using a + * [row value expression][org.jetbrains.kotlinx.dataframe.RowValueExpression]. + * + * For example: + * + * `df.`[update][update]`("city")`` { name.firstName + " from " + it }` + * + * `df.`[update][update]`("city")`` { it.uppercase() }` + * + * + * + * @param [columns] The [Column References][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + * @param [expression] The [Row Value Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowValueExpression.WithExample] to update the rows with. + */ +public fun DataFrame.update( + firstCol: ColumnReference, + vararg cols: ColumnReference, + expression: UpdateExpression, +): DataFrame = update(*headPlusArray(firstCol, cols)).with(expression) + +/** + * ## The Update Operation + * + * Returns the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with changed values in some cells + * (column types cannot be changed). + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.Update.Grammar] + * + * For more information: [See `update` on the documentation website.](https://kotlin.github.io/dataframe/update.html) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Update.UpdateSelectingOptions] + * for all the selecting options. + * ### This Update Overload + * This overload is a combination of [update] and [with][Update.with]. + * + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * Provide a new value for every selected cell given its row and its previous value using a + * [row value expression][org.jetbrains.kotlinx.dataframe.RowValueExpression]. + * + * For example: + * + * `df.`[update][update]`("city")`` { name.firstName + " from " + it }` + * + * `df.`[update][update]`("city")`` { it.uppercase() }` + * + * + * + * @param [columns] The [KProperties][KProperty] corresponding to columns of this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + * @param [expression] The [Row Value Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowValueExpression.WithExample] to update the rows with. + */ +public fun DataFrame.update( + firstCol: KProperty, + vararg cols: KProperty, + expression: UpdateExpression, +): DataFrame = update(*headPlusArray(firstCol, cols)).with(expression) + +/** + * ## The Update Operation + * + * Returns the [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with changed values in some cells + * (column types cannot be changed). + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.Update.Grammar] + * + * For more information: [See `update` on the documentation website.](https://kotlin.github.io/dataframe/update.html) + * + *      + * + * The columns to update need to be selected. See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Update.UpdateSelectingOptions] + * for all the selecting options. + * ### This Update Overload + * This overload is a combination of [update] and [with][Update.with]. + * + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * Provide a new value for every selected cell given its row and its previous value using a + * [row value expression][org.jetbrains.kotlinx.dataframe.RowValueExpression]. + * + * For example: + * + * `df.`[update][update]`("city")`` { name.firstName + " from " + it }` + * + * `df.`[update][update]`("city")`` { it.uppercase() }` + * + * + * + * @param [columns] The [Strings][String] corresponding to the names of columns belonging to this [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] to update. + * @param [expression] The [Row Value Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenRow.RowValueExpression.WithExample] to update the rows with. + */ +public fun DataFrame.update( + firstCol: String, + vararg cols: String, + expression: UpdateExpression, +): DataFrame = update(*headPlusArray(firstCol, cols)).with(expression) + +/** + * ## With Null + * Specific version of [with][org.jetbrains.kotlinx.dataframe.api.with] that simply sets the value of each selected row to `null`. + * + * For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { id }.`[where][org.jetbrains.kotlinx.dataframe.api.Update.where]` { it < 0 }.`[withNull][withNull]`()` + * + * + */ +public fun Update.withNull(): DataFrame = with { null } + +/** + * ## With Zero + * Specific version of [with][org.jetbrains.kotlinx.dataframe.api.with] that simply sets the value of each selected row to `0`. + * + * For example: + * + * `df.`[update][org.jetbrains.kotlinx.dataframe.api.update]` { id }.`[where][org.jetbrains.kotlinx.dataframe.api.Update.where]` { it < 0 }.`[withZero][withZero]`()` + * + * + */ +public fun Update.withZero(): DataFrame = updateWithValuePerColumnImpl { 0 as C } diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/uppercase.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/uppercase.kt new file mode 100644 index 000000000..e2595534a --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/uppercase.kt @@ -0,0 +1,9 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.StringCol + +// region StringCol + +public fun StringCol.uppercase(): StringCol = map { it?.uppercase() } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/valueCol.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/valueCol.kt new file mode 100644 index 000000000..82a2abf91 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/valueCol.kt @@ -0,0 +1,3081 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnGroupAccessor +import org.jetbrains.kotlinx.dataframe.ColumnGroupReference +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.ValueColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.getAt +import org.jetbrains.kotlinx.dataframe.impl.columns.onResolve +import org.jetbrains.kotlinx.dataframe.impl.columns.singleImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Value Col [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + * @param _UNUSED [#KT-68546](https://youtrack.jetbrains.com/issue/KT-68546/Conflicting-overloads-in-non-generic-interface-K2-2.0.0) + */ +public interface ValueColColumnsSelectionDsl { + + /** + * ## Value Col Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `index: `[`Int`][Int] + * + *      + * + * `T: Column type` + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`valueCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`valueCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]**`(`**[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`valueCol`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCol]`[`**`<`**[`T`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnTypeDef]**`>`**`]`**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` | `[`index`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.IndexDef]**`)`** + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`valueCol`**][ColumnsSelectionDsl.valueCol] */ + public interface PlainDslName + + /** __`.`__[**`valueCol`**][ColumnsSelectionDsl.valueCol] */ + public interface ColumnSetName + + /** __`.`__[**`valueCol`**][ColumnsSelectionDsl.valueCol] */ + public interface ColumnGroupName + } + + /** + * ## Value Col + * + * Creates a [ColumnAccessor] (or [SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath], [KProperty], or [ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { `[valueCol][valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][DataFrame.select]` { `[valueCol][valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[valueCol][valueCol]`(1) }` + * + * #### Examples for this overload: + * + * + * + * To create a [ColumnAccessor] for another kind of column, take a look at the functions + * [col][ColumnsSelectionDsl.col], + * [colGroup][ColumnsSelectionDsl.colGroup], + * and [frameCol][ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + */ + private interface CommonValueColDocs { + + // Example argument, can be either {@include [SingleExample]} or {@include [DoubleExample]} + interface ExampleArg + + /** + * `df.`[select][DataFrame.select]` { `[valueCol][valueCol]`() }` + */ + interface SingleExample + + /** + * `df.`[select][DataFrame.select]` { `[valueCol][valueCol]`() }` + * + * `df.`[select][DataFrame.select]` { `[valueCol][valueCol]`<`[String][String]`>() }` + */ + interface DoubleExample + + // Receiver argument for the example(s) + interface ReceiverArg + + // Argument for the example(s) + interface Arg + + // Optional note + interface Note + + /** @param [C] The type of the value column. */ + interface ValueColumnTypeParam + } + + // region reference + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor] pointing to the value column. + * @param [C] The type of the value column. + */ + private interface ValueColReferenceDocs + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the value column. + */ + public fun valueCol(valueCol: ColumnAccessor): ColumnAccessor = valueCol.ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the value column. + */ + public fun SingleColumn>.valueCol(valueCol: ColumnAccessor): SingleColumn = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(valueCol) + ?: throw IllegalStateException( + "ValueColumn '${valueCol.path()}' not found in column group '${it.path}'", + ) + child.data.ensureIsValueColumn() + listOf(child) + }.singleImpl() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the value column. + */ + public fun AnyColumnGroupAccessor.valueCol(valueCol: ColumnAccessor): ColumnAccessor = + this.ensureIsColumnGroup().valueColumn(valueCol.path()).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the value column. + */ + public fun String.valueCol(valueCol: ColumnAccessor): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(valueCol.path()).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the value column. + */ + public fun KProperty<*>.valueCol(valueCol: ColumnAccessor): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(valueCol.path()).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [col] The [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] pointing to the value column. + * @param [C] The type of the value column. + */ + public fun ColumnPath.valueCol(valueCol: ColumnAccessor): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(valueCol.path()).ensureIsValueColumn() + + // endregion + + // region name + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + private interface ValueColNameDocs + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun valueCol(name: String): ColumnAccessor<*> = valueColumn(name).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the value column. + */ + public fun valueCol(name: String): ColumnAccessor = valueColumn(name).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun SingleColumn>.valueCol(name: String): SingleColumn<*> = valueCol(name) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the value column. + */ + public fun SingleColumn>.valueCol(name: String): SingleColumn = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(name)?.cast() + ?: throw IllegalStateException("Value column '$name' not found in column group '${it.path}'") + child.data.ensureIsValueColumn() + listOf(child) + }.singleImpl() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun AnyColumnGroupAccessor.valueCol(name: String): ColumnAccessor<*> = valueCol(name) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the value column. + */ + public fun AnyColumnGroupAccessor.valueCol(name: String): ColumnAccessor = + this.ensureIsColumnGroup().valueColumn(name).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun String.valueCol(name: String): ColumnAccessor<*> = valueCol(name) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the value column. + */ + public fun String.valueCol(name: String): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(name).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun KProperty<*>.valueCol(name: String): ColumnAccessor<*> = valueCol(name) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the value column. + */ + public fun KProperty<*>.valueCol(name: String): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(name).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun ColumnPath.valueCol(name: String): ColumnAccessor<*> = valueCol(name) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("valueColumnName") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColumnName") }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [name] The name of the value column. + * @param [C] The type of the value column. + */ + public fun ColumnPath.valueCol(name: String): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(name).ensureIsValueColumn() + + // endregion + + // region path + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + private interface ValueColPathDocs + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun valueCol(path: ColumnPath): ColumnAccessor<*> = valueColumn(path).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the value column. + */ + public fun valueCol(path: ColumnPath): ColumnAccessor = valueColumn(path).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun SingleColumn>.valueCol(path: ColumnPath): SingleColumn<*> = valueCol(path) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the value column. + */ + public fun SingleColumn>.valueCol(path: ColumnPath): SingleColumn = + this.ensureIsColumnGroup().transformSingle { + val child = it.getCol(path)?.cast() + ?: throw IllegalStateException("Value column '$path' not found in column group '${it.path}'") + child.data.ensureIsValueColumn() + listOf(child) + }.singleImpl() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun AnyColumnGroupAccessor.valueCol(path: ColumnPath): ColumnAccessor<*> = valueCol(path) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the value column. + */ + public fun AnyColumnGroupAccessor.valueCol(path: ColumnPath): ColumnAccessor = + this.ensureIsColumnGroup().valueColumn(path).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun String.valueCol(path: ColumnPath): ColumnAccessor<*> = valueCol(path) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the value column. + */ + public fun String.valueCol(path: ColumnPath): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(path).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun KProperty<*>.valueCol(path: ColumnPath): ColumnAccessor<*> = valueCol(path) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the value column. + */ + public fun KProperty<*>.valueCol(path: ColumnPath): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(path).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun ColumnPath.valueCol(path: ColumnPath): ColumnAccessor<*> = valueCol(path) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`("pathTo"["valueColumnName"] ) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("pathTo"["valueColumnName"] ) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [path] The path to the value column. + * @param [C] The type of the value column. + */ + public fun ColumnPath.valueCol(path: ColumnPath): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(path).ensureIsValueColumn() + + // endregion + + // region property + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(Type::valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the value column. + */ + private interface ValueColKPropertyDocs + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(Type::valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the value column. + */ + public fun valueCol(property: KProperty): SingleColumn = valueColumn(property).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(Type::valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the value column. + */ + public fun SingleColumn>.valueCol(property: KProperty): SingleColumn = + valueCol(property.name) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(Type::valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the value column. + */ + public fun AnyColumnGroupAccessor.valueCol(property: KProperty): ColumnAccessor = + this.ensureIsColumnGroup().valueColumn(property).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(Type::valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the value column. + */ + public fun String.valueCol(property: KProperty): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(property).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(Type::valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the value column. + */ + public fun KProperty<*>.valueCol(property: KProperty): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(property).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(Type::valueColumnA) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [property] The [KProperty] reference to the value column. + * @param [C] The type of the value column. + */ + public fun ColumnPath.valueCol(property: KProperty): ColumnAccessor = + columnGroup(this).ensureIsColumnGroup().valueColumn(property).ensureIsValueColumn() + + // endregion + + // region index + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + private interface ValueColIndexDocs + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsOf][ColumnsSelectionDsl.colsOf]`<`[Int][Int]`>().`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the value column. + * + */ + public fun ColumnSet.valueCol(index: Int): SingleColumn = getAt(index).ensureIsValueColumn() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun ColumnsSelectionDsl<*>.valueCol(index: Int): SingleColumn<*> = valueCol(index) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the value column. + */ + public fun ColumnsSelectionDsl<*>.valueCol(index: Int): SingleColumn = asSingleColumn().valueCol(index) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun SingleColumn>.valueCol(index: Int): SingleColumn<*> = valueCol(index) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the value column. + */ + public fun SingleColumn>.valueCol(index: Int): SingleColumn = + this.ensureIsColumnGroup() + .allColumnsInternal() + .getAt(index) + .ensureIsValueColumn() + .cast() + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun String.valueCol(index: Int): SingleColumn<*> = valueCol(index) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the value column. + */ + public fun String.valueCol(index: Int): SingleColumn = columnGroup(this).valueCol(index) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun KProperty<*>.valueCol(index: Int): SingleColumn<*> = valueCol(index) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the value column. + */ + public fun KProperty<*>.valueCol(index: Int): SingleColumn = columnGroup(this).valueCol(index) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + */ + @Suppress("INAPPLICABLE_JVM_NAME") + @JvmName("valueColUnTyped") + public fun ColumnPath.valueCol(index: Int): SingleColumn<*> = valueCol(index) + + /** + * ## Value Col + * + * Creates a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] (or [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]) for a value column with the given argument which can be either + * an index ([Int]) or a reference to a column + * ([String], [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath], [KProperty], or [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]; any [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This is a DSL-shorthand for [valueColumn][org.jetbrains.kotlinx.dataframe.api.valueColumn] and can be both typed and untyped (in case you're supplying + * a column name, -path, or index). In addition, extra runtime checks are in place to ensure that the column + * you specify is actually a value column. + * The function can also be called on [ColumnGroups][org.jetbrains.kotlinx.dataframe.ColumnGroupReference] to create + * an accessor for a value column inside a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * + *      + * + * + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>("valueColA") }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(SomeType::valueColB) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColumnGroup.`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(1) }` + * + * #### Examples for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`(0) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myColumnGroup"].`[valueCol][org.jetbrains.kotlinx.dataframe.api.ValueColColumnsSelectionDsl.valueCol]`<`[String][String]`>(0) }` + * + * To create a [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for another kind of column, take a look at the functions + * [col][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col], + * [colGroup][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colGroup], + * and [frameCol][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.frameCol]. + * + * @return A [ColumnAccessor][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor] for the value column with the given argument if possible, else a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]. + * @throws [IllegalStateException] if the column with the given argument does not exist. + * @throws [IllegalArgumentException] if the column with the given argument is not a value column. + * + * @see [valueColumn] + * @see [ColumnsSelectionDsl.colGroup] + * @see [ColumnsSelectionDsl.frameCol] + * @see [ColumnsSelectionDsl.col] + * + * + * + * @param [index] The index of the value column. + * @throws [IndexOutOfBoundsException] if the index is out of bounds. + * @param [C] The type of the value column. + */ + public fun ColumnPath.valueCol(index: Int): SingleColumn = columnGroup(this).valueCol(index) + + // endregion +} + +/** + * Checks the validity of this [SingleColumn], + * by adding a check to see it's a [ValueColumn] (so, a [SingleColumn]<*>) + * and throwing an [IllegalArgumentException] if it's not. + */ +internal fun SingleColumn.ensureIsValueColumn(): SingleColumn = + onResolve { col: ColumnWithPath<*>? -> + require(col?.isValueColumn() != false) { + "Column at ${col?.path} is not a ValueColumn, but a ${col?.kind()}." + } + } + +/** Checks the validity of this [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn], + * by adding a check to see it's a [ValueColumn][org.jetbrains.kotlinx.dataframe.columns.ValueColumn] (so, a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]<*>) + * and throwing an [IllegalArgumentException] if it's not. */ +internal fun ColumnAccessor.ensureIsValueColumn(): ColumnAccessor = + onResolve { col: ColumnWithPath<*>? -> + require(col?.isValueColumn() != false) { + "Column at ${col?.path} is not a ValueColumn, but a ${col?.kind()}." + } + } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/valueCols.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/valueCols.kt new file mode 100644 index 000000000..f1c04c02e --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/valueCols.kt @@ -0,0 +1,362 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Predicate +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.ValueColumn +import org.jetbrains.kotlinx.dataframe.documentation.AccessApi +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Value Columns [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface ValueColsColumnsSelectionDsl { + + /** + * ## Value Columns Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`valueCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`valueCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`valueCols`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`valueCols`**][ColumnsSelectionDsl.valueCols] */ + public interface PlainDslName + + /** __`.`__[**`valueCols`**][ColumnsSelectionDsl.valueCols] */ + public interface ColumnSetName + + /** __`.`__[**`valueCols`**][ColumnsSelectionDsl.valueCols] */ + public interface ColumnGroupName + } + + /** + * ## Value Columns + * Creates a subset of columns from [this] that are [ValueColumns][ValueColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [valueCols] can be called using any of the supported [APIs][AccessApi] (+ [ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { `[valueCols][ColumnsSelectionDsl.valueCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][DataFrame.select]` { `[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]`().`[valueCols][ColumnsSelectionDsl.valueCols]`() }` + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[valueCols][String.valueCols]`() }` + * + * #### Examples for this overload: + * + * + * + * @param [filter] An optional [predicate][Predicate] to filter the value columns by. + * @return A [ColumnSet] of [ValueColumns][ValueColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + private interface CommonValueColsDocs { + + /** Example argument */ + interface ExampleArg + } + + /** + * ## Value Columns + * Creates a subset of columns from [this] that are [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [valueCols][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.valueCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[valueCols][kotlin.String.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[cols][ColumnsSelectionDsl.cols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") }.`[valueCols][ColumnSet.valueCols]`() }` + * + * `// NOTE: This can be shortened to just:` + * + * `df.`[select][DataFrame.select]` { `[valueCols][ColumnsSelectionDsl.valueCols]` { it.`[name][ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the value columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun ColumnSet<*>.valueCols(filter: Predicate> = { true }): TransformableColumnSet<*> = + valueColumnsInternal(filter) + + /** + * ## Value Columns + * Creates a subset of columns from [this] that are [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [valueCols][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.valueCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[valueCols][kotlin.String.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[valueCols][ColumnsSelectionDsl.valueCols]`() }` + * + * `df.`[select][DataFrame.select]` { `[valueCols][ColumnsSelectionDsl.valueCols]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the value columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun ColumnsSelectionDsl<*>.valueCols( + filter: Predicate> = { true }, + ): TransformableColumnSet<*> = asSingleColumn().valueColumnsInternal(filter) + + /** + * ## Value Columns + * Creates a subset of columns from [this] that are [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [valueCols][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.valueCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[valueCols][kotlin.String.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColGroup.`[valueCols][SingleColumn.valueCols]`() }` + * + * `df.`[select][DataFrame.select]` { myColGroup.`[valueCols][SingleColumn.valueCols]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the value columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun SingleColumn>.valueCols( + filter: Predicate> = { true }, + ): TransformableColumnSet<*> = this.ensureIsColumnGroup().valueColumnsInternal(filter) + + /** + * ## Value Columns + * Creates a subset of columns from [this] that are [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [valueCols][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.valueCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[valueCols][kotlin.String.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[valueCols][String.valueCols]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[valueCols][String.valueCols]`() }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the value columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun String.valueCols(filter: Predicate> = { true }): TransformableColumnSet<*> = + columnGroup(this).valueCols(filter) + + /** + * ## Value Columns + * Creates a subset of columns from [this] that are [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [valueCols][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.valueCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[valueCols][kotlin.String.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[valueCols][KProperty.valueCols]` { it.`[any][ColumnWithPath.any]` { it == "Alice" } } }` + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[valueCols][KProperty.valueCols]`() }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[valueCols][KProperty.valueCols]`() }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the value columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun KProperty<*>.valueCols(filter: Predicate> = { true }): TransformableColumnSet<*> = + columnGroup(this).valueCols(filter) + + /** + * ## Value Columns + * Creates a subset of columns from [this] that are [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * + * You can optionally use a [filter] to only include certain columns. + * [valueCols][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.valueCols] can be called using any of the supported [APIs][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] (+ [ColumnPath][org.jetbrains.kotlinx.dataframe.columns.ColumnPath]). + * + * This function operates solely on columns at the top-level. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.ValueColsColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`.`[startsWith][String.startsWith]`("my") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[colsAtAnyDepth][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsAtAnyDepth]`().`[valueCols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.valueCols]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColGroup".`[valueCols][kotlin.String.valueCols]`() }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myGroupCol"].`[valueCols][ColumnPath.valueCols]`() }` + * + * @param [filter] An optional [predicate][org.jetbrains.kotlinx.dataframe.Predicate] to filter the value columns by. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] of [ValueColumns][org.jetbrains.kotlinx.dataframe.columns.ValueColumn]. + * @see [ColumnsSelectionDsl.colsOfKind] + * @see [ColumnsSelectionDsl.frameCols] + * @see [ColumnsSelectionDsl.colGroups] + * @see [ColumnsSelectionDsl.cols] + */ + public fun ColumnPath.valueCols(filter: Predicate> = { true }): TransformableColumnSet<*> = + columnGroup(this).valueCols(filter) +} + +/** + * Returns a TransformableColumnSet containing the value columns that satisfy the given filter. + * + * @param filter The filter function to apply on each value column. Must accept a ValueColumn object and return a Boolean. + * @return A [TransformableColumnSet] containing the value columns that satisfy the filter. + */ +internal fun ColumnsResolver<*>.valueColumnsInternal(filter: (ValueColumn<*>) -> Boolean): TransformableColumnSet<*> = + colsInternal { it.isValueColumn() && filter(it) } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/valueCounts.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/valueCounts.kt new file mode 100644 index 000000000..1c96776b4 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/valueCounts.kt @@ -0,0 +1,97 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.DataSchema +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.nameGenerator +import kotlin.reflect.KProperty +import kotlin.reflect.full.withNullability +import kotlin.reflect.typeOf + +// region DataSchema + +@DataSchema +public interface ValueCount { + public val count: Int +} + +// endregion + +// region DataColumn + +internal val defaultCountColumnName: String = ValueCount::count.name + +public fun DataColumn.valueCounts( + sort: Boolean = true, + ascending: Boolean = false, + dropNA: Boolean = true, + resultColumn: String = defaultCountColumnName, +): DataFrame { + var grouped = toList().groupBy { it }.map { it.key to it.value.size } + if (sort) { + grouped = if (ascending) { + grouped.sortedBy { it.second } + } else { + grouped.sortedByDescending { it.second } + } + } + if (dropNA) grouped = grouped.filter { !it.first.isNA } + val nulls = if (dropNA) false else hasNulls() + val values = DataColumn.create(name(), grouped.map { it.first }, type().withNullability(nulls)) + val countName = if (resultColumn == name()) resultColumn + "1" else resultColumn + val counts = DataColumn.create(countName, grouped.map { it.second }, typeOf()) + return dataFrameOf(values, counts).cast() +} + +// endregion + +// region DataFrame + +public fun DataFrame.valueCounts( + sort: Boolean = true, + ascending: Boolean = false, + dropNA: Boolean = true, + resultColumn: String = defaultCountColumnName, + columns: ColumnsSelector? = null, +): DataFrame { + var df = if (columns != null) select(columns) else this + if (dropNA) df = df.dropNA() + + val rows by columnGroup() + val countName = nameGenerator().addUnique(resultColumn) + return df + .asColumnGroup(rows) + .asDataColumn() + .valueCounts(sort, ascending, dropNA, countName) + .ungroup(rows) + .cast() +} + +public fun DataFrame.valueCounts( + vararg columns: String, + sort: Boolean = true, + ascending: Boolean = false, + dropNA: Boolean = true, + resultColumn: String = defaultCountColumnName, +): DataFrame = valueCounts(sort, ascending, dropNA, resultColumn) { columns.toColumnSet() } + +public fun DataFrame.valueCounts( + vararg columns: AnyColumnReference, + sort: Boolean = true, + ascending: Boolean = false, + dropNA: Boolean = true, + resultColumn: String = defaultCountColumnName, +): DataFrame = valueCounts(sort, ascending, dropNA, resultColumn) { columns.toColumnSet() } + +public fun DataFrame.valueCounts( + vararg columns: KProperty<*>, + sort: Boolean = true, + ascending: Boolean = false, + dropNA: Boolean = true, + resultColumn: String = defaultCountColumnName, +): DataFrame = valueCounts(sort, ascending, dropNA, resultColumn) { columns.toColumnSet() } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/values.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/values.kt new file mode 100644 index 000000000..e63509f61 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/values.kt @@ -0,0 +1,192 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.aggregation.ColumnsForAggregateSelector +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.aggregation.columnValues +import org.jetbrains.kotlinx.dataframe.impl.aggregation.internal +import org.jetbrains.kotlinx.dataframe.impl.aggregation.remainingColumnsSelector +import org.jetbrains.kotlinx.dataframe.impl.valuesImpl +import kotlin.reflect.KProperty + +// region DataFrame + +public fun DataFrame.values(byRow: Boolean = false, columns: ColumnsSelector): Sequence = + valuesImpl(byRow, columns) + +public fun DataFrame.values(byRows: Boolean = false): Sequence = values(byRows) { all() } + +public fun DataFrame.valuesNotNull(byRow: Boolean = false, columns: ColumnsSelector): Sequence = + values(byRow, columns).filterNotNull() + +public fun DataFrame.valuesNotNull(byRow: Boolean = false): Sequence = valuesNotNull(byRow) { all() } + +// endregion + +// region GroupBy + +public fun Grouped.values( + vararg columns: AnyColumnReference, + dropNA: Boolean = false, + distinct: Boolean = false, +): DataFrame = values(dropNA, distinct) { columns.toColumnSet() } + +public fun Grouped.values( + vararg columns: String, + dropNA: Boolean = false, + distinct: Boolean = false, +): DataFrame = values(dropNA, distinct) { columns.toColumnSet() } + +public fun Grouped.values( + dropNA: Boolean = false, + distinct: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataFrame = aggregate { internal().columnValues(columns, true, dropNA, distinct) } + +public fun Grouped.values(dropNA: Boolean = false, distinct: Boolean = false): DataFrame = + values(dropNA, distinct, remainingColumnsSelector()) + +// endregion + +// region ReducedGroupBy + +public fun ReducedGroupBy.values(): DataFrame = values(groupBy.remainingColumnsSelector()) + +public fun ReducedGroupBy.values(vararg columns: AnyColumnReference): DataFrame = + values { columns.toColumnSet() } + +public fun ReducedGroupBy.values(vararg columns: String): DataFrame = values { columns.toColumnSet() } + +public fun ReducedGroupBy.values(vararg columns: KProperty<*>): DataFrame = + values { columns.toColumnSet() } + +public fun ReducedGroupBy.values(columns: ColumnsForAggregateSelector): DataFrame = + groupBy.aggregate { internal().columnValues(columns, reducer) } + +// endregion + +// region Pivot + +public fun Pivot.values( + dropNA: Boolean = false, + distinct: Boolean = false, + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataRow = delegate { values(dropNA, distinct, separate, columns) } + +public fun Pivot.values( + vararg columns: AnyColumnReference, + dropNA: Boolean = false, + distinct: Boolean = false, + separate: Boolean = false, +): DataRow = values(dropNA, distinct, separate) { columns.toColumnSet() } + +public fun Pivot.values( + vararg columns: String, + dropNA: Boolean = false, + distinct: Boolean = false, + separate: Boolean = false, +): DataRow = values(dropNA, distinct, separate) { columns.toColumnSet() } + +public fun Pivot.values( + vararg columns: KProperty<*>, + dropNA: Boolean = false, + distinct: Boolean = false, + separate: Boolean = false, +): DataRow = values(dropNA, distinct, separate) { columns.toColumnSet() } + +public fun Pivot.values( + dropNA: Boolean = false, + distinct: Boolean = false, + separate: Boolean = false, +): DataRow = + delegate { + values(dropNA, distinct, separate) + } + +// endregion + +// region ReducedPivot + +public fun ReducedPivot.values(separate: Boolean = false): DataRow = + pivot.delegate { reduce(reducer).values(separate = separate) } + +public fun ReducedPivot.values(vararg columns: AnyColumnReference, separate: Boolean = false): DataRow = + values(separate) { columns.toColumnSet() } + +public fun ReducedPivot.values(vararg columns: String, separate: Boolean = false): DataRow = + values(separate) { columns.toColumnSet() } + +public fun ReducedPivot.values(vararg columns: KProperty<*>, separate: Boolean = false): DataRow = + values(separate) { columns.toColumnSet() } + +public fun ReducedPivot.values( + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataRow = pivot.delegate { reduce(reducer).values(separate = separate, columns = columns) } + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.values( + dropNA: Boolean = false, + distinct: Boolean = false, + separate: Boolean = false, +): DataFrame = values(dropNA, distinct, separate, remainingColumnsSelector()) + +public fun PivotGroupBy.values( + vararg columns: AnyColumnReference, + dropNA: Boolean = false, + distinct: Boolean = false, + separate: Boolean = false, +): DataFrame = values(dropNA, distinct, separate) { columns.toColumnSet() } + +public fun PivotGroupBy.values( + vararg columns: String, + dropNA: Boolean = false, + distinct: Boolean = false, + separate: Boolean = false, +): DataFrame = values(dropNA, distinct, separate) { columns.toColumnSet() } + +public fun PivotGroupBy.values( + vararg columns: KProperty<*>, + dropNA: Boolean = false, + distinct: Boolean = false, + separate: Boolean = false, +): DataFrame = values(dropNA, distinct, separate) { columns.toColumnSet() } + +public fun PivotGroupBy.values( + dropNA: Boolean = false, + distinct: Boolean = false, + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataFrame = aggregate(separate = separate) { internal().columnValues(columns, false, dropNA, distinct) } + +// endregion + +// region ReducedPivotGroupBy + +public fun ReducedPivotGroupBy.values(separate: Boolean = false): DataFrame = + values(separate, pivot.remainingColumnsSelector()) + +public fun ReducedPivotGroupBy.values( + vararg columns: AnyColumnReference, + separate: Boolean = false, +): DataFrame = values(separate) { columns.toColumnSet() } + +public fun ReducedPivotGroupBy.values(vararg columns: String, separate: Boolean = false): DataFrame = + values(separate) { columns.toColumnSet() } + +public fun ReducedPivotGroupBy.values(vararg columns: KProperty<*>, separate: Boolean = false): DataFrame = + values(separate) { columns.toColumnSet() } + +public fun ReducedPivotGroupBy.values( + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataFrame = pivot.aggregate(separate = separate) { internal().columnValues(columns, reducer) } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/with.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/with.kt new file mode 100644 index 000000000..bb039e2b9 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/with.kt @@ -0,0 +1,56 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.impl.aggregation.internal +import org.jetbrains.kotlinx.dataframe.impl.aggregation.withExpr +import org.jetbrains.kotlinx.dataframe.impl.emptyPath +import kotlin.reflect.typeOf + +// region Pivot + +public inline fun Pivot.with(noinline expression: RowExpression): DataRow = + delegate { + with(expression) + } + +// endregion + +// region ReducedPivot + +public inline fun ReducedPivot.with(noinline expression: RowExpression): DataRow = + pivot.delegate { + reduce(reducer).with(expression) + } + +// endregion + +// region PivotGroupBy + +public inline fun PivotGroupBy.with(noinline expression: RowExpression): DataFrame { + val type = typeOf() + return aggregate { internal().withExpr(type, emptyPath(), expression) } +} + +// endregion + +// region ReducedPivotGroupBy + +public inline fun ReducedPivotGroupBy.with(noinline expression: RowExpression): DataFrame { + val type = typeOf() + return pivot.aggregate { + val value = reducer(this)?.let { + val value = expression(it, it) + if (value is AnyColumnReference) { + it[value] + } else { + value + } + } + internal().yield(emptyPath(), value, type) + } +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/withoutNulls.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/withoutNulls.kt new file mode 100644 index 000000000..ed6f5ccb0 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/withoutNulls.kt @@ -0,0 +1,283 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.api.WithoutNullsColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.transform +import kotlin.reflect.KProperty + +// region ColumnsSelectionDsl + +/** + * ## Without Nulls [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface WithoutNullsColumnsSelectionDsl { + + /** + * ## (Cols) Without Nulls Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`withoutNulls`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.withoutNulls]**`()`** + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`withoutNulls`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.withoutNulls]**`()`** + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`colsWithoutNulls`**][org.jetbrains.kotlinx.dataframe.api.WithoutNullsColumnsSelectionDsl.colsWithoutNulls]**`()`** + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`withoutNulls`**][ColumnsSelectionDsl.withoutNulls] */ + public interface PlainDslName + + /** __`.`__[**`withoutNulls`**][ColumnsSelectionDsl.withoutNulls] */ + public interface ColumnSetName + + /** __`.`__[**`colsWithoutNulls`**][ColumnsSelectionDsl.colsWithoutNulls] */ + public interface ColumnGroupName + } + + /** + * ## (Cols) Without Nulls + * Returns a new [ColumnSet] that contains only columns in [this] that do not have `null` values. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][ColumnGroup], `withoutNulls` is named `colsWithoutNulls` to avoid confusion. + * + * ### Check out: [Grammar] + * + * #### For Example: + * + * `df.`[select][DataFrame.select]` { `[all][ColumnsSelectionDsl.all]`().`[nameContains][ColumnsSelectionDsl.colsNameContains]`("middleName").`[withoutNulls][ColumnSet.withoutNulls]`() }` + * + * `df.`[select][DataFrame.select]` { `[withoutNulls][ColumnsSelectionDsl.withoutNulls]`() }` + * + * `df.`[select][DataFrame.select]` { Type::userData.`[colsWithoutNulls][SingleColumn.colsWithoutNulls]`() }` + * + * #### Examples for this overload: + * + * + * + * @return A [ColumnSet] containing only columns that do not contain `null`s and are thus non-nullable. + */ + private interface CommonWithoutNullsDocs { + + interface ExampleArg + } + + /** + * ## (Cols) Without Nulls + * Returns a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains only columns in [this] that do not have `null` values. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `withoutNulls` is named `colsWithoutNulls` to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.WithoutNullsColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[nameContains][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameContains]`("middleName").`[withoutNulls][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[withoutNulls][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::userData.`[colsWithoutNulls][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsWithoutNulls]`() }` + * + * #### Examples for this overload: + * + * + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing only columns that do not contain `null`s and are thus non-nullable. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.withoutNulls(): ColumnSet = + transform { cols -> cols.filter { !it.hasNulls() } } as ColumnSet + + /** + * ## (Cols) Without Nulls + * Returns a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains only columns in [this] that do not have `null` values. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `withoutNulls` is named `colsWithoutNulls` to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.WithoutNullsColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[nameContains][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameContains]`("middleName").`[withoutNulls][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[withoutNulls][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::userData.`[colsWithoutNulls][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsWithoutNulls]`() }` + * + * #### Examples for this overload: + * + * + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing only columns that do not contain `null`s and are thus non-nullable. + */ + public fun ColumnsSelectionDsl<*>.withoutNulls(): ColumnSet = asSingleColumn().colsWithoutNulls() + + /** + * ## (Cols) Without Nulls + * Returns a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains only columns in [this] that do not have `null` values. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `withoutNulls` is named `colsWithoutNulls` to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.WithoutNullsColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[nameContains][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameContains]`("middleName").`[withoutNulls][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[withoutNulls][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::userData.`[colsWithoutNulls][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsWithoutNulls]`() }` + * + * #### Examples for this overload: + * + * + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing only columns that do not contain `null`s and are thus non-nullable. + */ + public fun SingleColumn>.colsWithoutNulls(): ColumnSet = + ensureIsColumnGroup().allColumnsInternal().withoutNulls() + + /** + * ## (Cols) Without Nulls + * Returns a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains only columns in [this] that do not have `null` values. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `withoutNulls` is named `colsWithoutNulls` to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.WithoutNullsColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[nameContains][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameContains]`("middleName").`[withoutNulls][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[withoutNulls][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::userData.`[colsWithoutNulls][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsWithoutNulls]`() }` + * + * #### Examples for this overload: + * + * + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing only columns that do not contain `null`s and are thus non-nullable. + */ + public fun String.colsWithoutNulls(): ColumnSet = columnGroup(this).colsWithoutNulls() + + /** + * ## (Cols) Without Nulls + * Returns a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains only columns in [this] that do not have `null` values. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `withoutNulls` is named `colsWithoutNulls` to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.WithoutNullsColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[nameContains][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameContains]`("middleName").`[withoutNulls][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[withoutNulls][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::userData.`[colsWithoutNulls][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsWithoutNulls]`() }` + * + * #### Examples for this overload: + * + * + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing only columns that do not contain `null`s and are thus non-nullable. + */ + public fun KProperty<*>.colsWithoutNulls(): ColumnSet = columnGroup(this).colsWithoutNulls() + + /** + * ## (Cols) Without Nulls + * Returns a new [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] that contains only columns in [this] that do not have `null` values. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `withoutNulls` is named `colsWithoutNulls` to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.WithoutNullsColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[all][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.all]`().`[nameContains][org.jetbrains.kotlinx.dataframe.api.ColumnNameFiltersColumnsSelectionDsl.colsNameContains]`("middleName").`[withoutNulls][org.jetbrains.kotlinx.dataframe.columns.ColumnSet.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[withoutNulls][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.withoutNulls]`() }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::userData.`[colsWithoutNulls][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsWithoutNulls]`() }` + * + * #### Examples for this overload: + * + * + * + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing only columns that do not contain `null`s and are thus non-nullable. + */ + public fun ColumnPath.colsWithoutNulls(): ColumnSet = columnGroup(this).colsWithoutNulls() +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/xs.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/xs.kt new file mode 100644 index 000000000..af6efa877 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/xs.kt @@ -0,0 +1,29 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.impl.api.xsImpl + +// region DataFrame + +public fun DataFrame.xs(vararg keyValues: Any?): DataFrame = + xs(*keyValues) { + colsAtAnyDepth { !it.isColumnGroup() }.take(keyValues.size) + } + +public fun DataFrame.xs(vararg keyValues: C, keyColumns: ColumnsSelector): DataFrame = + xsImpl(keyColumns, false, *keyValues) + +// endregion + +// region GroupBy + +public fun GroupBy.xs(vararg keyValues: Any?): GroupBy = + xs(*keyValues) { + colsAtAnyDepth { !it.isColumnGroup() }.take(keyValues.size) + } + +public fun GroupBy.xs(vararg keyValues: C, keyColumns: ColumnsSelector): GroupBy = + xsImpl(*keyValues, keyColumns = keyColumns) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/CodeGenerator.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/CodeGenerator.kt new file mode 100644 index 000000000..3cda59f4b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/CodeGenerator.kt @@ -0,0 +1,74 @@ +package org.jetbrains.dataframe.impl.codeGen + +import org.jetbrains.kotlinx.dataframe.codeGen.CodeWithConverter +import org.jetbrains.kotlinx.dataframe.codeGen.DefaultReadDfMethod +import org.jetbrains.kotlinx.dataframe.codeGen.ExtensionsCodeGenerator +import org.jetbrains.kotlinx.dataframe.codeGen.Marker +import org.jetbrains.kotlinx.dataframe.codeGen.MarkerVisibility +import org.jetbrains.kotlinx.dataframe.codeGen.MarkersExtractor +import org.jetbrains.kotlinx.dataframe.codeGen.NameNormalizer +import org.jetbrains.kotlinx.dataframe.impl.codeGen.CodeGeneratorImpl +import org.jetbrains.kotlinx.dataframe.impl.codeGen.FullyQualifiedNames +import org.jetbrains.kotlinx.dataframe.impl.codeGen.ShortNames +import org.jetbrains.kotlinx.dataframe.impl.codeGen.id +import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema +import kotlin.reflect.KClass + +public enum class InterfaceGenerationMode { + NoFields, + WithFields, + Enum, + TypeAlias, + None, +} + +public data class CodeGenResult(val code: CodeWithConverter, val newMarkers: List) + +public interface CodeGenerator : ExtensionsCodeGenerator { + + public fun generate( + schema: DataFrameSchema, + name: String, + fields: Boolean, + extensionProperties: Boolean, + isOpen: Boolean, + visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC, + knownMarkers: Iterable = emptyList(), + readDfMethod: DefaultReadDfMethod? = null, + fieldNameNormalizer: NameNormalizer = NameNormalizer.id(), + asDataClass: Boolean = false, + ): CodeGenResult + + public fun generate( + marker: Marker, + interfaceMode: InterfaceGenerationMode, + extensionProperties: Boolean, + readDfMethod: DefaultReadDfMethod? = null, + ): CodeWithConverter + + public companion object { + public fun create(useFqNames: Boolean = true): CodeGenerator = + if (useFqNames) { + CodeGeneratorImpl(FullyQualifiedNames) + } else { + CodeGeneratorImpl(ShortNames) + } + } +} + +@PublishedApi +internal fun CodeGenerator.generate( + markerClass: KClass<*>, + interfaceMode: InterfaceGenerationMode, + extensionProperties: Boolean, +): CodeWithConverter = + generate( + MarkersExtractor.get(markerClass), + interfaceMode, + extensionProperties, + ) + +public inline fun CodeGenerator.generate( + interfaceMode: InterfaceGenerationMode, + extensionProperties: Boolean, +): CodeWithConverter = generate(T::class, interfaceMode, extensionProperties) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/CodeWithConverter.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/CodeWithConverter.kt new file mode 100644 index 000000000..a975fec2e --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/CodeWithConverter.kt @@ -0,0 +1,30 @@ +package org.jetbrains.kotlinx.dataframe.codeGen + +import org.jetbrains.kotlinx.jupyter.api.Code +import org.jetbrains.kotlinx.jupyter.api.VariableName + +/** + * Class representing generated code declarations for a [Marker]. + * + * @param declarations The generated code. + * @param converter Optional converter for the [Marker], such as a [org.jetbrains.kotlinx.dataframe.api.cast], often used for Jupyter. + */ +public data class CodeWithConverter(val declarations: Code, val converter: (VariableName) -> Code = EMPTY_CONVERTER) { + + public companion object { + public const val EMPTY_DECLARATIONS: Code = "" + public val EMPTY_CONVERTER: (VariableName) -> Code = { it } + public val EMPTY: CodeWithConverter = CodeWithConverter(EMPTY_DECLARATIONS, EMPTY_CONVERTER) + } + + val hasDeclarations: Boolean get() = declarations.isNotBlank() + + val hasConverter: Boolean get() = converter("it").trim() != "it" + + public fun with(name: VariableName): Code = + when { + !hasConverter -> declarations + !hasDeclarations -> converter(name) + else -> declarations + "\n" + converter(name) + } +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/DefaultReadDfMethods.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/DefaultReadDfMethods.kt new file mode 100644 index 000000000..6ecb10a3c --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/DefaultReadDfMethods.kt @@ -0,0 +1,95 @@ +package org.jetbrains.kotlinx.dataframe.codeGen + +import com.squareup.kotlinpoet.ClassName +import com.squareup.kotlinpoet.FunSpec +import com.squareup.kotlinpoet.KModifier +import com.squareup.kotlinpoet.ParameterSpec +import com.squareup.kotlinpoet.ParameterizedTypeName.Companion.parameterizedBy +import com.squareup.kotlinpoet.PropertySpec +import com.squareup.kotlinpoet.TypeSpec +import com.squareup.kotlinpoet.asClassName +import com.squareup.kotlinpoet.typeNameOf +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.io.MethodArguments + +public interface DefaultReadDfMethod { + public fun toDeclaration(marker: Marker, visibility: String): String + + public val additionalImports: List +} + +// Used APIs +private const val CAST = "cast" +private const val VERIFY = "verify" // cast(true) is obscure, i think it's better to use named argument here +private const val READ_CSV = "readCSV" +private const val READ_TSV = "readTSV" +private const val READ_JSON = "readJson" +private const val READ_JDBC = "readJdbc" + +public abstract class AbstractDefaultReadMethod( + private val path: String?, + private val arguments: MethodArguments, + private val methodName: String, +) : DefaultReadDfMethod { + override fun toDeclaration(marker: Marker, visibility: String): String { + val parameters = arguments.defaultValues.map { + ParameterSpec.builder(it.name, it.property.type) + .defaultValue("%N", it.property) + .build() + } + + val defaultPath = path?.let { + PropertySpec.builder("defaultPath", typeNameOf(), KModifier.CONST) + .initializer("%S", path) + .build() + } + + val type = DataFrame::class.asClassName().parameterizedBy(ClassName("", listOf(marker.shortName))) + + val arguments = parameters.joinToString(", ") { "${it.name} = ${it.name}" } + + val typeSpec = TypeSpec.companionObjectBuilder() + .apply { if (defaultPath != null) addProperty(defaultPath) } + .addProperties(this.arguments.defaultValues.map { it.property }) + .addFunction( + FunSpec.builder(methodName) + .returns(type) + .addParameter( + ParameterSpec.builder("path", typeNameOf()) + .apply { + if (defaultPath != null) { + defaultValue("%N", defaultPath) + } + }.build(), + ) + .addParameters(parameters) + .addParameter( + ParameterSpec.builder("verify", typeNameOf()) + .defaultValue("null") + .build(), + ) + .addCode( + """ + val df = DataFrame.$methodName(path, $arguments) + return if ($VERIFY != null) df.$CAST($VERIFY = $VERIFY) else df.$CAST() + """.trimIndent(), + ).build(), + ).build() + + return typeSpec.toString() + } + + override val additionalImports: List = listOf("import org.jetbrains.kotlinx.dataframe.io.$methodName") +} + +internal class DefaultReadJsonMethod(path: String?, arguments: MethodArguments) : + AbstractDefaultReadMethod( + path = path, + arguments = arguments, + methodName = READ_JSON, + ) + +internal class DefaultReadCsvMethod(path: String?, arguments: MethodArguments) : + AbstractDefaultReadMethod(path, arguments, READ_CSV) + +internal class DefaultReadTsvMethod(path: String?) : AbstractDefaultReadMethod(path, MethodArguments.EMPTY, READ_TSV) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/ExtensionsCodeGenerator.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/ExtensionsCodeGenerator.kt new file mode 100644 index 000000000..de874282f --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/ExtensionsCodeGenerator.kt @@ -0,0 +1,12 @@ +package org.jetbrains.kotlinx.dataframe.codeGen + +import org.jetbrains.kotlinx.dataframe.impl.codeGen.ExtensionsCodeGeneratorImpl +import org.jetbrains.kotlinx.dataframe.impl.codeGen.ShortNames + +public interface ExtensionsCodeGenerator { + public fun generate(marker: IsolatedMarker): CodeWithConverter + + public companion object { + public fun create(): ExtensionsCodeGenerator = ExtensionsCodeGeneratorImpl(ShortNames) + } +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/GeneratedField.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/GeneratedField.kt new file mode 100644 index 000000000..7ec248fc3 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/GeneratedField.kt @@ -0,0 +1,176 @@ +package org.jetbrains.kotlinx.dataframe.codeGen + +import org.jetbrains.kotlinx.dataframe.columns.ColumnKind +import org.jetbrains.kotlinx.dataframe.impl.codeGen.needsQuoting +import org.jetbrains.kotlinx.dataframe.schema.ColumnSchema + +public sealed interface FieldType { + public data class ValueFieldType(public val typeFqName: String) : FieldType + + public data class FrameFieldType( + public val markerName: String, + public val nullable: Boolean, + public val renderAsList: Boolean, + ) : FieldType + + public data class GroupFieldType(public val markerName: String, public val renderAsObject: Boolean) : FieldType +} + +/** + * Returns whether the column type ends with `?` or not. + * NOTE: for [FieldType.FrameFieldType], the `nullable` property indicates the nullability of the frame itself, not the type of the column. + */ +public fun FieldType.isNullable(): Boolean = + when (this) { + is FieldType.FrameFieldType -> markerName.endsWith("?") || markerName == "*" + is FieldType.GroupFieldType -> markerName.endsWith("?") || markerName == "*" + is FieldType.ValueFieldType -> typeFqName.endsWith("?") || typeFqName == "*" + } + +/** + * Returns whether the column type doesn't end with `?` or whether it does. + * NOTE: for [FieldType.FrameFieldType], the `nullable` property indicates the nullability of the frame itself, not the type of the column. + */ +public fun FieldType.isNotNullable(): Boolean = !isNullable() + +private fun String.toNullable() = if (this.last() == '?' || this == "*") this else "$this?" + +/** + * Returns a new fieldType with the same type but with nullability in the column type. + * NOTE: for [FieldType.FrameFieldType], the `nullable` property indicates the nullability of the frame itself, not the type of the column. + */ +public fun FieldType.toNullable(): FieldType = + if (isNotNullable()) { + when (this) { + is FieldType.FrameFieldType -> FieldType.FrameFieldType(markerName.toNullable(), nullable, renderAsList) + is FieldType.GroupFieldType -> FieldType.GroupFieldType(markerName.toNullable(), renderAsObject) + is FieldType.ValueFieldType -> FieldType.ValueFieldType(typeFqName.toNullable()) + } + } else { + this + } + +/** + * Returns a new fieldType with the same type but with nullability disabled in the column type. + * NOTE: for [FieldType.FrameFieldType], the `nullable` property indicates the nullability of the frame itself, not the type of the column. + */ +public fun FieldType.toNotNullable(): FieldType = + if (isNullable()) { + when (this) { + is FieldType.FrameFieldType -> + FieldType.FrameFieldType( + markerName = markerName.let { + if (it == "*") { + "Any" + } else { + it.removeSuffix("?") + } + }, + nullable = nullable, + renderAsList = renderAsList, + ) + + is FieldType.GroupFieldType -> + FieldType.GroupFieldType( + markerName = markerName.let { + if (it == "*") { + "Any" + } else { + it.removeSuffix("?") + } + }, + renderAsObject = renderAsObject, + ) + + is FieldType.ValueFieldType -> + FieldType.ValueFieldType( + typeFqName = typeFqName.let { + if (it == "*") { + "Any" + } else { + it.removeSuffix("?") + } + }, + ) + } + } else { + this + } + +public val FieldType.name: String + get() = when (this) { + is FieldType.FrameFieldType -> markerName + is FieldType.GroupFieldType -> markerName + is FieldType.ValueFieldType -> typeFqName + } + +public class ValidFieldName private constructor(private val identifier: String, public val needsQuote: Boolean) { + public val unquoted: String get() = identifier + public val quotedIfNeeded: String get() = if (needsQuote) "`$identifier`" else identifier + + public operator fun plus(other: ValidFieldName): ValidFieldName = + ValidFieldName(identifier = identifier + other.identifier, needsQuote = needsQuote || other.needsQuote) + + override fun toString(): String = identifier + + public companion object { + public fun of(name: String): ValidFieldName { + val needsQuote = name.needsQuoting() + var result = name + if (needsQuote) { + result = name.replace("<", "{") + .replace(">", "}") + .replace("::", " - ") + .replace(": ", " - ") + .replace(":", " - ") + .replace(".", " ") + .replace("/", "-") + .replace("[", "{") + .replace("]", "}") + .replace("`", "'") + .replace(";", " ") + .replace("\\", " ") + } + + return ValidFieldName(result, needsQuote) + } + } +} + +public interface BaseField { + public val fieldName: ValidFieldName + public val columnName: String + public val fieldType: FieldType +} + +public fun BaseField.toNullable(): BaseField = + if (fieldType.isNullable()) { + this + } else { + object : BaseField { + override val fieldName: ValidFieldName = this@toNullable.fieldName + override val columnName: String = this@toNullable.columnName + override val fieldType: FieldType = this@toNullable.fieldType.toNullable() + } + } + +public fun BaseField.toNotNullable(): BaseField = + if (fieldType.isNotNullable()) { + this + } else { + object : BaseField { + override val fieldName: ValidFieldName = this@toNotNullable.fieldName + override val columnName: String = this@toNotNullable.columnName + override val fieldType: FieldType = this@toNotNullable.fieldType.toNotNullable() + } + } + +public data class GeneratedField( + override val fieldName: ValidFieldName, + override val columnName: String, + val overrides: Boolean, + val columnSchema: ColumnSchema, + override val fieldType: FieldType, +) : BaseField { + val columnKind: ColumnKind get() = columnSchema.kind +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/Marker.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/Marker.kt new file mode 100644 index 000000000..d52bd6305 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/Marker.kt @@ -0,0 +1,121 @@ +package org.jetbrains.kotlinx.dataframe.codeGen + +import org.jetbrains.kotlinx.dataframe.impl.schema.DataFrameSchemaImpl +import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema +import kotlin.reflect.KClass + +public enum class MarkerVisibility { + INTERNAL, + IMPLICIT_PUBLIC, + EXPLICIT_PUBLIC, +} + +public interface IsolatedMarker { + public val name: String + public val fields: List + public val visibility: MarkerVisibility + + /** + * Type parameters for in front of the function or getter/setter. + * Like `` in `val MyType.something get() = ...`. + */ + public val typeParameters: String + + /** + * Type arguments belonging to this marker. + * Like `` in `MyMarker`. + */ + public val typeArguments: String +} + +public abstract class AbstractMarker(typeParameters: List, typeArguments: List) : IsolatedMarker { + override val typeParameters: String = typeParameters.join() + override val typeArguments: String = typeArguments.join() + + private fun List.join() = + if (isEmpty()) { + "" + } else { + joinToString(", ", "<", ">") + } +} + +public open class Marker( + override val name: String, + public val isOpen: Boolean, + override val fields: List, + superMarkers: List, + override val visibility: MarkerVisibility, + typeParameters: List, + typeArguments: List, +) : AbstractMarker(typeParameters, typeArguments) { + + public val shortName: String + get() = name.substringAfterLast(".") + + public val superMarkers: Map = superMarkers.associateBy { it.name } + + public val allSuperMarkers: Map by lazy { + val result = this.superMarkers.toMutableMap() + this.superMarkers.forEach { + result.putAll(it.value.allSuperMarkers) + } + result + } + + public val allFields: List by lazy { + + val fieldsMap = mutableMapOf() + this.superMarkers.values.forEach { + it.allFields.forEach { + fieldsMap[it.fieldName.quotedIfNeeded] = it + } + } + fields.forEach { + fieldsMap[it.fieldName.quotedIfNeeded] = it + } + fieldsMap.values.toList() + } + + public val allFieldsByColumn: Map by lazy { + allFields.associateBy { it.columnName } + } + + public fun getField(columnName: String): GeneratedField? = allFieldsByColumn[columnName] + + public fun containsColumn(columnName: String): Boolean = allFieldsByColumn.containsKey(columnName) + + public val columnNames: List get() = allFields.map { it.columnName } + + public val schema: DataFrameSchema by lazy { + DataFrameSchemaImpl(allFields.associate { it.columnName to it.columnSchema }) + } + + public fun implements(schema: Marker): Boolean = + if (schema.name == name) true else allSuperMarkers[schema.name]?.let { it === schema } ?: false + + public fun implementsAll(schemas: Iterable): Boolean = schemas.all { implements(it) } + + internal companion object { + operator fun invoke( + name: String, + isOpen: Boolean, + fields: List, + superMarkers: List, + visibility: MarkerVisibility, + klass: KClass<*>, + ): Marker { + val typeParameters = klass.typeParameters.map { + buildString { + append(it.name) + if (it.upperBounds.isNotEmpty()) { + append(" : ") + append(it.upperBounds.joinToString(",") { it.toString() }) + } + } + } + val typeArguments = klass.typeParameters.map { it.name } + return Marker(name, isOpen, fields, superMarkers, visibility, typeParameters, typeArguments) + } + } +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/MarkersExtractor.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/MarkersExtractor.kt new file mode 100644 index 000000000..5458c9de4 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/MarkersExtractor.kt @@ -0,0 +1,123 @@ +package org.jetbrains.kotlinx.dataframe.codeGen + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.annotations.ColumnName +import org.jetbrains.kotlinx.dataframe.annotations.DataSchema +import org.jetbrains.kotlinx.dataframe.annotations.ScopeProperty +import org.jetbrains.kotlinx.dataframe.impl.schema.getPropertyOrderFromPrimaryConstructor +import org.jetbrains.kotlinx.dataframe.schema.ColumnSchema +import kotlin.reflect.KClass +import kotlin.reflect.KType +import kotlin.reflect.full.findAnnotation +import kotlin.reflect.full.hasAnnotation +import kotlin.reflect.full.memberProperties +import kotlin.reflect.full.superclasses +import kotlin.reflect.full.withNullability +import kotlin.reflect.jvm.jvmErasure +import kotlin.reflect.typeOf + +internal fun KType.getFieldKind(): FieldKind = + when { + jvmErasure == DataFrame::class -> Frame + jvmErasure == List::class && (arguments[0].type?.jvmErasure?.hasAnnotation() == true) -> ListToFrame + jvmErasure == DataRow::class -> Group + jvmErasure.hasAnnotation() -> ObjectToGroup + else -> Default + } + +internal sealed interface FieldKind { + val shouldBeConvertedToColumnGroup: Boolean get() = false + val shouldBeConvertedToFrameColumn: Boolean get() = false +} + +internal data object Frame : FieldKind { + override val shouldBeConvertedToFrameColumn: Boolean = true +} + +internal data object ListToFrame : FieldKind { + override val shouldBeConvertedToFrameColumn: Boolean = true +} + +internal data object Default : FieldKind + +internal data object Group : FieldKind { + override val shouldBeConvertedToColumnGroup: Boolean = true +} + +internal data object ObjectToGroup : FieldKind { + override val shouldBeConvertedToColumnGroup: Boolean = true +} + +private fun String.toNullable(): String = if (endsWith("?")) this else "$this?" + +internal object MarkersExtractor { + + private val cache = mutableMapOf, Boolean>, Marker>() + + inline fun get() = get(T::class) + + fun get(markerClass: KClass<*>, nullableProperties: Boolean = false): Marker = + cache.getOrPut(Pair(markerClass, nullableProperties)) { + val fields = getFields(markerClass, nullableProperties) + val isOpen = !markerClass.isSealed && + markerClass.java.isInterface && + markerClass.findAnnotation()?.isOpen == true + + val baseSchemas = markerClass.superclasses.filter { it != Any::class }.map { get(it, nullableProperties) } + Marker( + name = markerClass.qualifiedName ?: markerClass.simpleName!!, + isOpen = isOpen, + fields = fields, + superMarkers = baseSchemas, + visibility = MarkerVisibility.IMPLICIT_PUBLIC, + klass = markerClass, + ) + } + + private fun getFields(markerClass: KClass<*>, nullableProperties: Boolean): List { + val order = getPropertyOrderFromPrimaryConstructor(markerClass) ?: emptyMap() + val structuralProperties = markerClass.memberProperties.filter { !it.hasAnnotation() } + return structuralProperties.sortedBy { order[it.name] ?: Int.MAX_VALUE }.map { + val fieldName = ValidFieldName.of(it.name) + val columnName = it.findAnnotation()?.name ?: fieldName.unquoted + val type = it.returnType + val fieldType: FieldType + val clazz = type.jvmErasure + val fieldKind = type.getFieldKind() + val columnSchema = when { + fieldKind.shouldBeConvertedToColumnGroup -> { + val nestedType = if (clazz == DataRow::class) type.arguments[0].type ?: typeOf() else type + val marker = get(nestedType.jvmErasure, nullableProperties || type.isMarkedNullable) + fieldType = FieldType.GroupFieldType( + marker.name, + renderAsObject = fieldKind is ObjectToGroup, + ) + ColumnSchema.Group(marker.schema, nestedType) + } + + fieldKind.shouldBeConvertedToFrameColumn -> { + val frameType = type.arguments[0].type ?: typeOf() + val marker = get(frameType.jvmErasure, nullableProperties || type.isMarkedNullable) + fieldType = FieldType.FrameFieldType( + marker.name, + type.isMarkedNullable || nullableProperties, + renderAsList = fieldKind is ListToFrame, + ) + ColumnSchema.Frame(marker.schema, type.isMarkedNullable, frameType) + } + + else -> { + fieldType = FieldType.ValueFieldType( + if (nullableProperties) type.toString().toNullable() else type.toString(), + ) + ColumnSchema.Value( + if (nullableProperties) type.withNullability(true) else type, + ) + } + } + + GeneratedField(fieldName, columnName, false, columnSchema, fieldType) + } + } +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/NameNormalizer.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/NameNormalizer.kt new file mode 100644 index 000000000..78ba98a3c --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/NameNormalizer.kt @@ -0,0 +1,5 @@ +package org.jetbrains.kotlinx.dataframe.codeGen + +public class NameNormalizer(private val f: (String) -> String) : (String) -> String by f { + public companion object +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/ReplCodeGenerator.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/ReplCodeGenerator.kt new file mode 100644 index 000000000..2b3a830aa --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/ReplCodeGenerator.kt @@ -0,0 +1,24 @@ +package org.jetbrains.dataframe.impl.codeGen + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.codeGen.CodeWithConverter +import org.jetbrains.kotlinx.dataframe.impl.codeGen.ReplCodeGeneratorImpl +import org.jetbrains.kotlinx.jupyter.api.Code +import kotlin.reflect.KClass +import kotlin.reflect.KProperty + +internal interface ReplCodeGenerator { + + fun process(df: AnyFrame, property: KProperty<*>? = null): CodeWithConverter + + fun process(row: AnyRow, property: KProperty<*>? = null): CodeWithConverter + + fun process(markerClass: KClass<*>): Code + + companion object { + fun create(): ReplCodeGenerator = ReplCodeGeneratorImpl() + } +} + +internal inline fun ReplCodeGenerator.process(): Code = process(T::class) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/SchemaProcessor.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/SchemaProcessor.kt new file mode 100644 index 000000000..ddfac8530 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/SchemaProcessor.kt @@ -0,0 +1,25 @@ +package org.jetbrains.kotlinx.dataframe.codeGen + +import org.jetbrains.kotlinx.dataframe.impl.codeGen.SchemaProcessorImpl +import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema + +internal interface SchemaProcessor { + + val generatedMarkers: List + + val namePrefix: String + + fun process( + schema: DataFrameSchema, + isOpen: Boolean, + visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC, + ): Marker + + companion object { + fun create( + namePrefix: String, + existingMarkers: Iterable = emptyList(), + fieldNameNormalizer: (String) -> String = { it }, + ): SchemaProcessorImpl = SchemaProcessorImpl(existingMarkers, namePrefix, fieldNameNormalizer) + } +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/CellKind.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/CellKind.kt new file mode 100644 index 000000000..a545c2d96 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/CellKind.kt @@ -0,0 +1,15 @@ +package org.jetbrains.kotlinx.dataframe.columns + +/** + * Represents special kinds of elements that can be found within a Column. + * This is similar to the [ColumnKind], but it applies to specific elements of the Column. + * Its main use is to provide metadata during serialization for visualization within the KTNB plugin. + */ +internal enum class CellKind { + /** + * Represents a cell kind within a Column that is specifically convertible to a DataFrame. + */ + DataFrameConvertable { + override fun toString(): String = "DataFrameConvertable" + }, +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnAccessor.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnAccessor.kt new file mode 100644 index 000000000..4536755c6 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnAccessor.kt @@ -0,0 +1,27 @@ +package org.jetbrains.kotlinx.dataframe.columns + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.api.column +import org.jetbrains.kotlinx.dataframe.api.columnGroup +import org.jetbrains.kotlinx.dataframe.api.frameColumn +import kotlin.reflect.KProperty + +/** + * Combination of [column path][path] and [column type][T]. + * + * Used to retrieve [DataColumn] from [DataFrame] or value from [DataRow]. + * + * Can be created by [column], [columnGroup] or [frameColumn] delegates. + * + * @param T Expected [type][DataColumn.type] of values in the column + */ +public interface ColumnAccessor : ColumnReference { + + public override operator fun getValue(thisRef: Any?, property: KProperty<*>): ColumnAccessor = this + + public operator fun get(column: ColumnReference): ColumnAccessor + + override fun rename(newName: String): ColumnAccessor +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnKind.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnKind.kt new file mode 100644 index 000000000..d6c326075 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnKind.kt @@ -0,0 +1,13 @@ +package org.jetbrains.kotlinx.dataframe.columns + +public enum class ColumnKind { + Value { + override fun toString(): String = "ValueColumn" + }, + Group { + override fun toString(): String = "ColumnGroup" + }, + Frame { + override fun toString(): String = "FrameColumn" + }, +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnPath.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnPath.kt new file mode 100644 index 000000000..3db5677ee --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnPath.kt @@ -0,0 +1,116 @@ +package org.jetbrains.kotlinx.dataframe.columns + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl +import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnAccessorImpl +import org.jetbrains.kotlinx.dataframe.impl.owner + +/** + * Path to a [column][DataColumn] in [DataFrame]. + * + * Stores a list of [column names][DataColumn.name] that are used to retrieve columns through a chain of [column groups][ColumnGroup]. + */ +public data class ColumnPath(val path: List) : + List by path, + ColumnAccessor { + + public constructor(name: String) : this(listOf(name)) + + public fun drop(size: Int): ColumnPath = ColumnPath(path.drop(size)) + + public fun parent(): ColumnPath? = if (path.isEmpty()) null else dropLast(1) + + /** + * Returns a shortened [ColumnPath] without the last [size] elements. + * + * NOTE: If called from the [ColumnsSelectionDsl], you might be looking for [ColumnsSelectionDsl.dropLastChildren] + * instead. + */ + public fun dropLast(size: Int = 1): ColumnPath = ColumnPath(path.dropLast(size)) + + /** + * Returns a shortened [ColumnPath] without the first [size] elements. + * + * NOTE: If called from the [ColumnsSelectionDsl], you might be looking for [ColumnsSelectionDsl.dropChildren] + * instead. + */ + public fun dropFirst(size: Int = 1): ColumnPath = ColumnPath(path.drop(size)) + + public operator fun plus(name: String): ColumnPath = ColumnPath(path + name) + + public operator fun plus(otherPath: ColumnPath): ColumnPath = ColumnPath(path + otherPath.path) + + public operator fun plus(otherPath: Iterable): ColumnPath = ColumnPath(path + otherPath) + + /** + * Returns a shortened [ColumnPath] containing just the first [first] elements. + * + * NOTE: If called from the [ColumnsSelectionDsl], you might be looking for [ColumnsSelectionDsl.takeCols] + * instead. + */ + public fun take(first: Int): ColumnPath = ColumnPath(path.take(first)) + + public fun replaceLast(name: String): ColumnPath = + ColumnPath(if (path.size < 2) listOf(name) else path.dropLast(1) + name) + + /** + * Returns a shortened [ColumnPath] containing just the last [last] elements. + * + * NOTE: If called from the [ColumnsSelectionDsl], you might be looking for [ColumnsSelectionDsl.takeLast] + * instead. + */ + public fun takeLast(last: Int): ColumnPath = ColumnPath(path.takeLast(last)) + + override fun path(): ColumnPath = this + + override fun name(): String = path.last() + + val columnName: String get() = name() + + val parentName: String? get() = if (path.size > 1) path[path.size - 2] else null + + override fun rename(newName: String): ColumnPath = ColumnPath(path.dropLast(1) + newName) + + override fun getValue(row: AnyRow): Any? = row.owner[this][row.index()] + + override fun getValueOrNull(row: AnyRow): Any? = row.owner.getColumnOrNull(this)?.get(row.index()) + + override fun toString(): String = path.toString() + + public fun joinToString(separator: String = "/"): String = path.joinToString(separator) + + override fun get(column: ColumnReference): ColumnAccessor = ColumnAccessorImpl(this + column.path()) +} + +/** + * Drops the overlapping start of the child path with respect to the parent path, and returns the resulting ColumnPath. + * + * For example: + * ```kt + * val parentPath = pathOf("a", "b", "c") + * val childPath = pathOf("a", "b", "c", "d", "e") + * + * childPath.dropStartWrt(parentPath) // returns pathOf("d", "e") + * ``` + * + * @param otherPath The parent path to compare against. + * @return The resulting ColumnPath after dropping the overlapping start. + */ +internal fun ColumnPath.dropStartWrt(otherPath: ColumnPath): ColumnPath { + val first = dropOverlappingStartOfChild(parent = otherPath, child = this) + return ColumnPath(first) +} + +internal fun dropOverlappingStartOfChild(parent: List, child: List): List { + var indexToRemoveTill = 0 + for (i in child.indices) { + val subFirst = child.subList(0, i + 1) + val sufficientSubSecond = parent.subList(maxOf(0, parent.size - (i + 1)), parent.size) + if (subFirst == sufficientSubSecond) { + indexToRemoveTill = i + 1 + } + } + return child.subList(indexToRemoveTill, child.size) +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnReference.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnReference.kt new file mode 100644 index 000000000..768c6858e --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnReference.kt @@ -0,0 +1,48 @@ +package org.jetbrains.kotlinx.dataframe.columns + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.api.name +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.columns.RenamedColumnReference +import org.jetbrains.kotlinx.dataframe.impl.columns.addPath +import org.jetbrains.kotlinx.dataframe.impl.columns.getColumn +import kotlin.reflect.KProperty + +/** + * Entity that can retrieve [DataColumn] from [DataFrame] or value from [DataRow]. + * + * Base interface for [DataColumn] and [ColumnAccessor]. + * @param C Expected [type][DataColumn.type] of values in the column + */ +public interface ColumnReference : SingleColumn { + + public operator fun getValue(thisRef: Any?, property: KProperty<*>): ColumnReference = + renamedReference(property.columnName) + + public fun name(): String + + public fun rename(newName: String): ColumnReference + + public fun path(): ColumnPath = ColumnPath(name) + + public fun getValue(row: AnyRow): C = resolveFor(row.df())!![row.index()] + + public fun getValueOrNull(row: AnyRow): C? = resolveFor(row.df())?.get(row.index()) + + override fun resolveSingle(context: ColumnResolutionContext): ColumnWithPath? = + context.df + .getColumn(path(), context.unresolvedColumnsPolicy) + ?.addPath(path()) +} + +internal fun ColumnReference.renamedReference(newName: String): ColumnReference = + RenamedColumnReference(this, newName) + +internal fun ColumnReference<*>.shortPath() = ColumnPath(name) + +internal fun ColumnReference.resolveFor(df: AnyFrame): ColumnWithPath? = + resolveSingle(ColumnResolutionContext(df, UnresolvedColumnsPolicy.Skip)) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnSet.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnSet.kt new file mode 100644 index 000000000..046b9c2bd --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnSet.kt @@ -0,0 +1,37 @@ +package org.jetbrains.kotlinx.dataframe.columns + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl +import org.jetbrains.kotlinx.dataframe.api.asSingleColumn + +/** + * ## ColumnSet + * + * Entity that can be resolved into a list of [columns][DataColumn]. + * Just like [SingleColumn], this is a [ColumnsResolver]. + * + * @see [SingleColumn] + * @see [ColumnsResolver] + */ +public interface ColumnSet : ColumnsResolver + +internal fun ColumnsResolver.asColumnSet(): ColumnSet = + when (this) { + is ColumnSet -> this + + else -> object : ColumnSet { + override fun resolve(context: ColumnResolutionContext): List> = + this@asColumnSet.resolve(context) + } + } + +@Suppress("UNCHECKED_CAST") +@PublishedApi +internal fun SingleColumn.asColumnSet(): ColumnSet = + when (this) { + is ColumnSet<*> -> this as ColumnSet + else -> object : ColumnSet, SingleColumn by this {} + } + +internal fun ColumnsSelectionDsl.asColumnSet(): ColumnSet> = asSingleColumn().asColumnSet() diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnWithPath.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnWithPath.kt new file mode 100644 index 000000000..1ed1c1a6e --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnWithPath.kt @@ -0,0 +1,63 @@ +package org.jetbrains.kotlinx.dataframe.columns + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.api.asColumnGroup +import org.jetbrains.kotlinx.dataframe.api.isColumnGroup +import org.jetbrains.kotlinx.dataframe.impl.columns.addParentPath +import org.jetbrains.kotlinx.dataframe.impl.columns.addPath +import org.jetbrains.kotlinx.dataframe.impl.columns.depth +import kotlin.reflect.KProperty + +public interface ColumnWithPath : DataColumn { + public val data: DataColumn + + public val path: ColumnPath + + public val name: String get() = name() + + public val parentName: String? get() = path.parentName + + public fun depth(): Int = path.depth() + + /** + * Casts this column to a [ColumnGroup] and returns a column with the specified [accessor] or null if it + * can't be found. + */ + public fun getCol(accessor: ColumnReference): ColumnWithPath? = + asColumnGroup().getColumnOrNull(accessor)?.addPath(path + accessor.path()) + + /** + * Casts this column to a [ColumnGroup] and returns a column with the specified [name] or null if it + * can't be found. + */ + public fun getCol(name: String): ColumnWithPath? = asColumnGroup().getColumnOrNull(name)?.addParentPath(path) + + /** + * Casts this column to a [ColumnGroup] and returns a column with the specified [index] or null if it + * can't be found. + */ + public fun getCol(index: Int): ColumnWithPath? = asColumnGroup().getColumnOrNull(index)?.addParentPath(path) + + /** + * Casts this column to a [ColumnGroup] and returns a column with the specified [accessor] or null if it + * can't be found. + */ + public fun getCol(accessor: KProperty): ColumnWithPath? = + asColumnGroup().getColumnOrNull(accessor)?.addParentPath(path) + + /** + * Returns all ("children") columns in this column if it's a group, else it returns an empty list. + */ + public fun cols(): List> = + if (isColumnGroup()) { + data.asColumnGroup().columns().map { it.addParentPath(path) } + } else { + emptyList() + } + + override fun path(): ColumnPath = path + + override fun rename(newName: String): ColumnWithPath +} + +public val ColumnWithPath.depth: Int get() = path.depth() diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnsResolver.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnsResolver.kt new file mode 100644 index 000000000..700d76fbb --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ColumnsResolver.kt @@ -0,0 +1,42 @@ +package org.jetbrains.kotlinx.dataframe.columns + +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableSingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.transform + +/** + * ## ColumnsResolver + * Entity that can be resolved into a list of [columns][DataColumn]. + * + * Used as a return type of [ColumnsSelector]. + * + * Implemented by [SingleColumn] and [ColumnSet]. + * + * @param C common type of resolved columns + * @see [SingleColumn] + * @see [ColumnSet] + * @see [TransformableColumnSet] + * @see [TransformableSingleColumn] + */ +public sealed interface ColumnsResolver { + + /** + * Resolves this [ColumnsResolver] as a [List]<[ColumnWithPath]<[C]>>. + * In many cases this function [transforms][ColumnsResolver.transform] a parent [ColumnsResolver] to reach + * the current [ColumnsResolver] result. + */ + public fun resolve(context: ColumnResolutionContext): List> +} + +public class ColumnResolutionContext internal constructor( + internal val df: DataFrame<*>, + internal val unresolvedColumnsPolicy: UnresolvedColumnsPolicy, +) { + + public val allowMissingColumns: Boolean = unresolvedColumnsPolicy != UnresolvedColumnsPolicy.Fail +} + +internal enum class UnresolvedColumnsPolicy { Fail, Skip, Create } diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/FrameColumn.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/FrameColumn.kt new file mode 100644 index 000000000..70b988740 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/FrameColumn.kt @@ -0,0 +1,23 @@ +package org.jetbrains.kotlinx.dataframe.columns + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema + +/** + * Column that stores values of type [DataFrame] + * + * @param T schema marker of contained dataframes. See [DataFrame] for details. + */ +public interface FrameColumn : DataColumn> { + + public val schema: Lazy + + override fun distinct(): FrameColumn + + override fun kind(): ColumnKind = ColumnKind.Frame + + override fun rename(newName: String): FrameColumn + + override fun get(indices: Iterable): FrameColumn +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/SingleColumn.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/SingleColumn.kt new file mode 100644 index 000000000..e8d0e048b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/SingleColumn.kt @@ -0,0 +1,33 @@ +package org.jetbrains.kotlinx.dataframe.columns + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.api.isColumnGroup +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableSingleColumn + +/** + * ## SingleColumn + * Entity that can be [resolved][resolveSingle] into a single [DataColumn]. + * + * @param C Column [type][BaseColumn.type] of resolved column. + * @see [ColumnsResolver] + * @see [TransformableColumnSet] + * @see [TransformableSingleColumn] + */ +public interface SingleColumn : ColumnsResolver { + + override fun resolve(context: ColumnResolutionContext): List> = + resolveSingle(context) + ?.let { listOf(it) } + ?: emptyList() + + public fun resolveSingle(context: ColumnResolutionContext): ColumnWithPath? +} + +public fun ColumnsResolver<*>.isSingleColumn(): Boolean = this is SingleColumn<*> + +/** + * Returns true if [this] is a [SingleColumn] and [cols] consists of a single column group. + */ +public fun ColumnsResolver<*>.isSingleColumnWithGroup(cols: List>): Boolean = + isSingleColumn() && cols.singleOrNull()?.isColumnGroup() == true diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ValueColumn.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ValueColumn.kt new file mode 100644 index 000000000..a1d898429 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/ValueColumn.kt @@ -0,0 +1,25 @@ +package org.jetbrains.kotlinx.dataframe.columns + +import org.jetbrains.kotlinx.dataframe.DataColumn +import kotlin.reflect.KProperty + +/** + * Column that stores values. + * + * @param T - type of values + */ +public interface ValueColumn : DataColumn { + + override fun kind(): ColumnKind = ColumnKind.Value + + override fun distinct(): ValueColumn + + override fun get(indices: Iterable): ValueColumn + + override fun rename(newName: String): ValueColumn + + override operator fun getValue(thisRef: Any?, property: KProperty<*>): ValueColumn = + super.getValue(thisRef, property) as ValueColumn + + public override operator fun get(range: IntRange): ValueColumn +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/constructors.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/constructors.kt new file mode 100644 index 000000000..4cc2e9b7c --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/columns/constructors.kt @@ -0,0 +1,66 @@ +package org.jetbrains.kotlinx.dataframe.columns + +import org.jetbrains.kotlinx.dataframe.api.toColumnAccessor +import org.jetbrains.kotlinx.dataframe.impl.asList +import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnsList +import kotlin.reflect.KProperty + +// region toColumnSet + +// region Array + +public fun Array>.toColumnSet(): ColumnSet = ColumnsList(asList()) + +@JvmName("toColumnSetString") +public fun Array.toColumnSet(): ColumnSet = map { it.toColumnAccessor() }.toColumnSet() + +@JvmName("toColumnSetColumnPath") +public fun Array.toColumnSet(): ColumnSet = map { it.toColumnAccessor() }.toColumnSet() + +public fun Array>.toColumnSet(): ColumnSet = map { it.toColumnAccessor() }.toColumnSet() + +@JvmName("toColumnSetC") +public fun Array>.toColumnSet(): ColumnSet = ColumnsList(asList()) + +public fun Array>.toColumnSet(): ColumnSet = asIterable().toColumnSet() + +// endregion + +// region Iterable + +public fun Iterable>.toColumnSet(): ColumnSet = ColumnsList(asList()) + +@JvmName("toColumnSetString") +public fun Iterable.toColumnSet(): ColumnSet = map { it.toColumnAccessor() }.toColumnSet() + +@JvmName("toColumnSetColumnPath") +public fun Iterable.toColumnSet(): ColumnSet = map { it.toColumnAccessor() }.toColumnSet() + +@JvmName("toColumnSetKProperty") +public fun Iterable>.toColumnSet(): ColumnSet = map { it.toColumnAccessor() }.toColumnSet() + +@JvmName("toColumnSetC") +public fun Iterable>.toColumnSet(): ColumnSet = ColumnsList(toList()) + +@JvmName("toColumnSetColumnReference") +public fun Iterable>.toColumnSet(): ColumnSet = ColumnsList(toList()) + +// endregion + +// endregion + +// region toColumnSetOf + +// region Array + +public fun Array.toColumnsSetOf(): ColumnSet = toColumnSet() as ColumnSet + +// endregion + +// region Iterable + +public fun Iterable.toColumnsSetOf(): ColumnSet = toColumnSet() as ColumnSet + +// endregion + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/dataTypes/IFRAME.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/dataTypes/IFRAME.kt new file mode 100644 index 000000000..547544576 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/dataTypes/IFRAME.kt @@ -0,0 +1,24 @@ +package org.jetbrains.kotlinx.dataframe.dataTypes + +import java.net.URL + +public data class IFRAME( + val src: String, + val border: Boolean = false, + val width: Int? = null, + val height: Int? = null, +) { + public constructor( + src: URL, + border: Boolean = false, + width: Int? = null, + height: Int? = null, + ) : this(src.toString(), border, width, height) + + override fun toString(): String = + """

cast(): Gather { + // TODO: introduce GatherWithTransform to avoid this error + require(valueTransform == null) { "Cast is not allowed to be called after `mapValues`" } + return this as Gather + } +} + +// region into + +public fun Gather.into(keyColumn: String, valueColumn: String): DataFrame = + gatherImpl(keyColumn, valueColumn) + +public fun Gather.into( + keyColumn: ColumnAccessor, + valueColumn: ColumnAccessor, +): DataFrame = into(keyColumn.name(), valueColumn.name) + +public fun Gather.into(keyColumn: KProperty, valueColumn: KProperty): DataFrame = + into(keyColumn.columnName, valueColumn.columnName) + +// endregion + +// region keysInto + +public fun Gather.keysInto(keyColumn: String): DataFrame = gatherImpl(keyColumn, null) + +public fun Gather.keysInto(keyColumn: ColumnAccessor): DataFrame = + keysInto(keyColumn.name()) + +public fun Gather.keysInto(keyColumn: KProperty): DataFrame = + keysInto(keyColumn.columnName) + +// endregion + +// region valuesInto + +public fun Gather.valuesInto(valueColumn: String): DataFrame = gatherImpl(null, valueColumn) + +public fun Gather.valuesInto(valueColumn: ColumnAccessor): DataFrame = + valuesInto(valueColumn.name()) + +public fun Gather.valuesInto(valueColumn: KProperty): DataFrame = + valuesInto(valueColumn.columnName) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/generateCode.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/generateCode.kt new file mode 100644 index 000000000..a51e0815a --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/generateCode.kt @@ -0,0 +1,87 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.dataframe.impl.codeGen.CodeGenerator +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.codeGen.MarkerVisibility +import org.jetbrains.kotlinx.dataframe.codeGen.NameNormalizer +import org.jetbrains.kotlinx.dataframe.impl.codeGen.from + +public inline fun DataFrame.generateCode( + fields: Boolean = true, + extensionProperties: Boolean = true, +): CodeString { + val name = markerName() + return generateCode(name, fields, extensionProperties) +} + +public fun DataFrame.generateCode( + markerName: String, + fields: Boolean = true, + extensionProperties: Boolean = true, + visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC, +): CodeString { + val codeGen = CodeGenerator.create() + return codeGen.generate( + schema = schema(), + name = markerName, + fields = fields, + extensionProperties = extensionProperties, + isOpen = true, + visibility = visibility, + ).code.declarations.toCodeString() +} + +public inline fun DataFrame.generateInterfaces(): CodeString = + generateCode( + fields = true, + extensionProperties = false, + ) + +public inline fun DataFrame.generateDataClasses( + markerName: String? = null, + extensionProperties: Boolean = false, + visibility: MarkerVisibility = MarkerVisibility.IMPLICIT_PUBLIC, + useFqNames: Boolean = false, + nameNormalizer: NameNormalizer = NameNormalizer.default, +): CodeString { + val name = markerName ?: markerName() + val codeGen = CodeGenerator.create(useFqNames) + return codeGen.generate( + schema = schema(), + name = name, + fields = true, + extensionProperties = extensionProperties, + isOpen = false, + visibility = visibility, + asDataClass = true, + fieldNameNormalizer = nameNormalizer, + ).code.declarations.toCodeString() +} + +@PublishedApi +internal inline fun markerName(): String = + if (T::class.isAbstract) { + T::class.simpleName!! + } else { + "DataEntry" + } + +public fun DataFrame.generateInterfaces(markerName: String): CodeString = + generateCode( + markerName = markerName, + fields = true, + extensionProperties = false, + ) + +/** + * Converts delimited 'my_name', 'my name', etc., String to camelCase 'myName' + */ +public val NameNormalizer.Companion.default: NameNormalizer get() = NameNormalizer.from(setOf('\t', ' ', '_')) + +@JvmInline +public value class CodeString(public val value: String) { + override fun toString(): String = value +} + +@PublishedApi +internal fun String.toCodeString(): CodeString = CodeString(this) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/group.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/group.kt new file mode 100644 index 000000000..9bd4c1602 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/group.kt @@ -0,0 +1,58 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnGroupAccessor +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columnName +import kotlin.experimental.ExperimentalTypeInference +import kotlin.reflect.KProperty + +// region DataFrame + +@Interpretable("Group0") +public fun DataFrame.group(columns: ColumnsSelector): GroupClause = GroupClause(this, columns) + +public fun DataFrame.group(vararg columns: String): GroupClause = group { columns.toColumnSet() } + +public fun DataFrame.group(vararg columns: AnyColumnReference): GroupClause = + group { columns.toColumnSet() } + +public fun DataFrame.group(vararg columns: KProperty<*>): GroupClause = group { columns.toColumnSet() } + +// endregion + +// region GroupClause + +public class GroupClause(internal val df: DataFrame, internal val columns: ColumnsSelector) { + override fun toString(): String = "GroupClause(df=$df, columns=$columns)" +} + +// region into + +@JvmName("intoString") +@OverloadResolutionByLambdaReturnType +@OptIn(ExperimentalTypeInference::class) +public fun GroupClause.into(column: ColumnsSelectionDsl.(ColumnWithPath) -> String): DataFrame = + df.move(columns).under { column(it).toColumnAccessor() } + +@JvmName("intoColumn") +public fun GroupClause.into( + column: ColumnsSelectionDsl.(ColumnWithPath) -> AnyColumnReference, +): DataFrame = df.move(columns).under(column) + +@Refine +@Interpretable("Into0") +public fun GroupClause.into(column: String): DataFrame = into(columnGroup().named(column)) + +public fun GroupClause.into(column: AnyColumnGroupAccessor): DataFrame = df.move(columns).under(column) + +public fun GroupClause.into(column: KProperty<*>): DataFrame = into(column.columnName) + +// endregion + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/groupBy.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/groupBy.kt new file mode 100644 index 000000000..4067b6b4f --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/groupBy.kt @@ -0,0 +1,107 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Selector +import org.jetbrains.kotlinx.dataframe.aggregation.Aggregatable +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.aggregation.PivotImpl +import org.jetbrains.kotlinx.dataframe.impl.api.getPivotColumnPaths +import org.jetbrains.kotlinx.dataframe.impl.api.groupByImpl +import kotlin.reflect.KProperty + +// region DataFrame + +/** + * + * @param cols key columns; Column for grouping can be created inplace + * + * `df.groupBy { expr("columnName") { "someColumn"() + 15 } }` + * + * is equivalent to + * + * `df.add("columnName") { "someColumn"() + 15 }.groupBy("columnName")` + */ +@Refine +@Interpretable("DataFrameGroupBy") +public fun DataFrame.groupBy(moveToTop: Boolean = true, cols: ColumnsSelector): GroupBy = + groupByImpl(moveToTop, cols) + +public fun DataFrame.groupBy(vararg cols: KProperty<*>): GroupBy = groupBy { cols.toColumnSet() } + +public fun DataFrame.groupBy(vararg cols: String): GroupBy = groupBy { cols.toColumnSet() } + +public fun DataFrame.groupBy(vararg cols: AnyColumnReference, moveToTop: Boolean = true): GroupBy = + groupBy(moveToTop) { cols.toColumnSet() } + +// endregion + +// region Pivot + +public fun Pivot.groupBy(moveToTop: Boolean = true, columns: ColumnsSelector): PivotGroupBy = + (this as PivotImpl).toGroupedPivot(moveToTop, columns) + +public fun Pivot.groupBy(vararg columns: AnyColumnReference): PivotGroupBy = groupBy { columns.toColumnSet() } + +public fun Pivot.groupBy(vararg columns: String): PivotGroupBy = groupBy { columns.toColumnSet() } + +public fun Pivot.groupBy(vararg columns: KProperty<*>): PivotGroupBy = groupBy { columns.toColumnSet() } + +public fun Pivot.groupByOther(): PivotGroupBy { + val impl = this as PivotImpl + val pivotColumns = df.getPivotColumnPaths(columns).toColumnSet() + return impl.toGroupedPivot(moveToTop = false) { allExcept(pivotColumns) } +} + +// endregion + +public typealias GroupedRowSelector = GroupedDataRow.(GroupedDataRow) -> R + +public typealias GroupedRowFilter = GroupedRowSelector + +public interface GroupedDataRow : DataRow { + + public fun group(): DataFrame +} + +public val GroupedDataRow.group: DataFrame get() = group() + +public data class GroupWithKey(val key: DataRow, val group: DataFrame) + +public interface GroupBy : Grouped { + + public val groups: FrameColumn + + public val keys: DataFrame + + public fun updateGroups(transform: Selector, DataFrame>): GroupBy + + public fun filter(predicate: GroupedRowFilter): GroupBy + + @Refine + @Interpretable("GroupByToDataFrame") + public fun toDataFrame(groupedColumnName: String? = null): DataFrame + + public data class Entry(val key: DataRow, val group: DataFrame) + + public companion object { + internal val groupedColumnAccessor = column("group") + } +} + +public interface Grouped : Aggregatable + +public class ReducedGroupBy( + @PublishedApi internal val groupBy: GroupBy, + @PublishedApi internal val reducer: Selector, DataRow?>, +) { + override fun toString(): String = "ReducedGroupBy(groupBy=$groupBy, reducer=$reducer)" +} + +internal fun GroupBy.reduce(reducer: Selector, DataRow?>) = ReducedGroupBy(this, reducer) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/head.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/head.kt new file mode 100644 index 000000000..3c23f050a --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/head.kt @@ -0,0 +1,9 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame + +// region DataFrame + +public fun DataFrame.head(numRows: Int = 5): DataFrame = take(numRows) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/implode.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/implode.kt new file mode 100644 index 000000000..fac6243b9 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/implode.kt @@ -0,0 +1,27 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.implodeImpl +import kotlin.reflect.KProperty + +// region DataFrame + +public fun DataFrame.implode(dropNA: Boolean = false): DataRow = implode(dropNA) { all() }[0] + +public fun DataFrame.implode(dropNA: Boolean = false, columns: ColumnsSelector): DataFrame = + implodeImpl(dropNA, columns) + +public fun DataFrame.implode(vararg columns: String, dropNA: Boolean = false): DataFrame = + implode(dropNA) { columns.toColumnSet() } + +public fun DataFrame.implode(vararg columns: ColumnReference, dropNA: Boolean = false): DataFrame = + implode(dropNA) { columns.toColumnSet() } + +public fun DataFrame.implode(vararg columns: KProperty, dropNA: Boolean = false): DataFrame = + implode(dropNA) { columns.toColumnSet() } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/indices.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/indices.kt new file mode 100644 index 000000000..6edc8c300 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/indices.kt @@ -0,0 +1,18 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.RowFilter +import org.jetbrains.kotlinx.dataframe.indices + +// region DataFrame + +public fun AnyFrame.indices(): IntRange = 0 until rowsCount() + +public fun DataFrame.indices(filter: RowFilter): List = + indices.filter { + val row = get(it) + filter(row, row) + } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/inferType.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/inferType.kt new file mode 100644 index 000000000..eab0222ee --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/inferType.kt @@ -0,0 +1,29 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.guessColumnType +import org.jetbrains.kotlinx.dataframe.type +import kotlin.reflect.KProperty + +public fun AnyCol.inferType(): DataColumn<*> = guessColumnType(name, toList(), type, true) + +// region DataFrame + +public fun DataFrame.inferType(): DataFrame = inferType { colsAtAnyDepth { !it.isColumnGroup() } } + +public fun DataFrame.inferType(columns: ColumnsSelector): DataFrame = + replace(columns).with { it.inferType() } + +public fun DataFrame.inferType(vararg columns: String): DataFrame = inferType { columns.toColumnSet() } + +public fun DataFrame.inferType(vararg columns: ColumnReference<*>): DataFrame = + inferType { columns.toColumnSet() } + +public fun DataFrame.inferType(vararg columns: KProperty<*>): DataFrame = inferType { columns.toColumnSet() } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/into.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/into.kt new file mode 100644 index 000000000..7026b72e4 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/into.kt @@ -0,0 +1,82 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.impl.aggregation.internal +import org.jetbrains.kotlinx.dataframe.impl.aggregation.withExpr +import org.jetbrains.kotlinx.dataframe.impl.columnName +import kotlin.reflect.KProperty +import kotlin.reflect.typeOf + +// region GroupBy + +public fun GroupBy.into(column: String): DataFrame = toDataFrame(column) + +public fun GroupBy.into(column: ColumnAccessor): DataFrame = toDataFrame(column.name()) + +public fun GroupBy.into(column: KProperty): DataFrame = toDataFrame(column.columnName) + +public inline fun GroupBy.into( + columnName: String? = null, + noinline expression: RowExpression, +): DataFrame = into(pathOf(columnName ?: groups.name()).cast(), expression) + +public inline fun GroupBy.into( + column: ColumnAccessor, + noinline expression: RowExpression, +): DataFrame { + val type = typeOf() + val path = column.path() + return aggregate { + internal().withExpr(type, path, expression) + } +} + +public inline fun GroupBy.into( + column: KProperty, + noinline expression: RowExpression, +): DataFrame = into(column.columnName, expression) + +// endregion + +// region ReducedGroupBy + +public inline fun ReducedGroupBy.into( + columnName: String? = null, + noinline expression: RowExpression, +): DataFrame { + val type = typeOf() + val name = columnName ?: groupBy.groups.name() + return groupBy.aggregate { + val row = reducer(it, it) + if (row != null) { + internal().yield(pathOf(name), expression(row, row), type) + } + } +} + +public inline fun ReducedGroupBy.into( + column: ColumnAccessor, + noinline expression: RowExpression, +): DataFrame = into(column.name(), expression) + +public inline fun ReducedGroupBy.into( + column: KProperty, + noinline expression: RowExpression, +): DataFrame = into(column.columnName, expression) + +public fun ReducedGroupBy.into(columnName: String): DataFrame = into(columnName) { this } + +public fun ReducedGroupBy.into(column: ColumnAccessor): DataFrame = into(column) { this } + +public fun ReducedGroupBy.into(column: KProperty): DataFrame = into(column) { this } + +public fun ReducedGroupBy.concat(): DataFrame = + groupBy.groups.values() + .map { reducer(it, it) } + .concat() + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/isEmpty.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/isEmpty.kt new file mode 100644 index 000000000..cc38be3bd --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/isEmpty.kt @@ -0,0 +1,13 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.ncol +import org.jetbrains.kotlinx.dataframe.nrow + +// region DataFrame + +public fun AnyFrame.isEmpty(): Boolean = ncol == 0 || nrow == 0 + +public fun AnyFrame.isNotEmpty(): Boolean = !isEmpty() + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/join.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/join.kt new file mode 100644 index 000000000..ea54b2c3b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/join.kt @@ -0,0 +1,137 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnsContainer +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnResolutionContext +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.joinImpl +import kotlin.reflect.KProperty + +@Refine +@Interpretable("Join0") +public fun DataFrame.join( + other: DataFrame, + type: JoinType = JoinType.Inner, + selector: JoinColumnsSelector? = null, +): DataFrame = joinImpl(other, type, addNewColumns = type.addNewColumns, selector) + +public fun DataFrame.join( + other: DataFrame, + vararg columns: String, + type: JoinType = JoinType.Inner, +): DataFrame = join(other, type) { columns.toColumnSet() } + +public fun DataFrame.innerJoin( + other: DataFrame, + selector: JoinColumnsSelector? = null, +): DataFrame = join(other, JoinType.Inner, selector = selector) + +public fun DataFrame.innerJoin(other: DataFrame, vararg columns: String): DataFrame = + innerJoin(other) { columns.toColumnSet() } + +public fun DataFrame.leftJoin( + other: DataFrame, + selector: JoinColumnsSelector? = null, +): DataFrame = join(other, JoinType.Left, selector = selector) + +public fun DataFrame.leftJoin(other: DataFrame, vararg columns: String): DataFrame = + leftJoin(other) { columns.toColumnSet() } + +public fun DataFrame.rightJoin( + other: DataFrame, + selector: JoinColumnsSelector? = null, +): DataFrame = join(other, JoinType.Right, selector = selector) + +public fun DataFrame.rightJoin(other: DataFrame, vararg columns: String): DataFrame = + rightJoin(other) { columns.toColumnSet() } + +public fun DataFrame.fullJoin( + other: DataFrame, + selector: JoinColumnsSelector? = null, +): DataFrame = join(other, JoinType.Full, selector = selector) + +public fun DataFrame.fullJoin(other: DataFrame, vararg columns: String): DataFrame = + fullJoin(other) { columns.toColumnSet() } + +public fun DataFrame.filterJoin( + other: DataFrame, + selector: JoinColumnsSelector? = null, +): DataFrame = joinImpl(other, JoinType.Inner, addNewColumns = false, selector = selector) + +public fun DataFrame.filterJoin(other: DataFrame, vararg columns: String): DataFrame = + filterJoin(other) { columns.toColumnSet() } + +public fun DataFrame.excludeJoin( + other: DataFrame, + selector: JoinColumnsSelector? = null, +): DataFrame = joinImpl(other, JoinType.Exclude, addNewColumns = false, selector = selector) + +public fun DataFrame.excludeJoin(other: DataFrame, vararg columns: String): DataFrame = + excludeJoin(other) { columns.toColumnSet() } + +public fun Iterable>.joinOrNull( + joinType: JoinType = JoinType.Inner, + selector: JoinColumnsSelector? = null, +): DataFrame? = + fold, DataFrame?>(null) { joined, new -> joined?.join(new, joinType, selector = selector) ?: new } + +public interface JoinDsl : ColumnsSelectionDsl { + + public val right: DataFrame + + @Interpretable("Match0") + public infix fun ColumnReference.match(other: ColumnReference): ColumnMatch = ColumnMatch(this, other) + + public infix fun String.match(other: ColumnReference): ColumnMatch = ColumnMatch(toColumnOf(), other) + + public infix fun ColumnReference.match(other: String): ColumnMatch = ColumnMatch(this, other.toColumnOf()) + + public infix fun String.match(other: String): ColumnMatch = + ColumnMatch(toColumnAccessor(), other.toColumnAccessor()) + + public infix fun KProperty.match(other: KProperty): ColumnMatch = + ColumnMatch(toColumnAccessor(), other.toColumnAccessor()) + + public infix fun ColumnReference.match(other: KProperty): ColumnMatch = + ColumnMatch(this, other.toColumnAccessor()) + + public infix fun KProperty.match(other: ColumnReference): ColumnMatch = + ColumnMatch(toColumnAccessor(), other) +} + +public class ColumnMatch(public val left: ColumnReference, public val right: ColumnReference) : ColumnSet { + + override fun resolve(context: ColumnResolutionContext): List> = + throw UnsupportedOperationException() +} + +public typealias JoinColumnsSelector = JoinDsl.(ColumnsContainer) -> ColumnsResolver<*> + +public enum class JoinType { + Left, // all data from left data frame, nulls for mismatches in right data frame + Right, // all data from right data frame, nulls for mismatches in left data frame + Inner, // only matched data from right and left data frame + Filter, // only matched data from left data frame + Full, // all data from left and from right data frame, nulls for any mismatches + Exclude, // mismatched rows from left data frame +} + +internal val JoinType.addNewColumns: Boolean + get() = when (this) { + JoinType.Filter, JoinType.Exclude -> false + JoinType.Left, JoinType.Right, JoinType.Inner, JoinType.Full -> true + } + +public val JoinType.allowLeftNulls: Boolean + get() = this == JoinType.Right || this == JoinType.Full + +public val JoinType.allowRightNulls: Boolean + get() = this == JoinType.Left || + this == JoinType.Full || + this == JoinType.Exclude diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/joinWith.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/joinWith.kt new file mode 100644 index 000000000..a6453dba2 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/joinWith.kt @@ -0,0 +1,38 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Selector +import org.jetbrains.kotlinx.dataframe.impl.api.joinWithImpl + +public interface JoinedDataRow : DataRow { + public val right: DataRow +} + +public typealias JoinExpression = Selector, Boolean> + +public fun DataFrame.joinWith( + right: DataFrame, + type: JoinType = JoinType.Inner, + joinExpression: JoinExpression, +): DataFrame = joinWithImpl(right, type, addNewColumns = type.addNewColumns, joinExpression) + +public fun DataFrame.innerJoinWith(right: DataFrame, joinExpression: JoinExpression): DataFrame = + joinWith(right, JoinType.Inner, joinExpression) + +public fun DataFrame.leftJoinWith(right: DataFrame, joinExpression: JoinExpression): DataFrame = + joinWith(right, JoinType.Left, joinExpression) + +public fun DataFrame.rightJoinWith(right: DataFrame, joinExpression: JoinExpression): DataFrame = + joinWith(right, JoinType.Right, joinExpression) + +public fun DataFrame.fullJoinWith(right: DataFrame, joinExpression: JoinExpression): DataFrame = + joinWith(right, JoinType.Full, joinExpression) + +public fun DataFrame.filterJoinWith(right: DataFrame, joinExpression: JoinExpression): DataFrame = + joinWithImpl(right, JoinType.Inner, addNewColumns = false, joinExpression) + +public fun DataFrame.excludeJoinWith( + right: DataFrame, + joinExpression: JoinExpression, +): DataFrame = joinWithImpl(right, JoinType.Exclude, addNewColumns = false, joinExpression) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/last.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/last.kt new file mode 100644 index 000000000..9c95dbda8 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/last.kt @@ -0,0 +1,384 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowFilter +import org.jetbrains.kotlinx.dataframe.api.LastColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.asColumnSet +import org.jetbrains.kotlinx.dataframe.columns.size +import org.jetbrains.kotlinx.dataframe.columns.values +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableSingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.singleOrNullWithTransformerImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.transform +import org.jetbrains.kotlinx.dataframe.nrow +import kotlin.reflect.KProperty + +// region DataColumn + +public fun DataColumn.last(): T = get(size - 1) + +public fun DataColumn.lastOrNull(): T? = if (size > 0) last() else null + +public fun DataColumn.last(predicate: (T) -> Boolean): T = values.last(predicate) + +public fun DataColumn.lastOrNull(predicate: (T) -> Boolean): T? = values.lastOrNull(predicate) + +// endregion + +// region DataFrame + +public fun DataFrame.lastOrNull(predicate: RowFilter): DataRow? = + rowsReversed().firstOrNull { predicate(it, it) } + +public fun DataFrame.last(predicate: RowFilter): DataRow = rowsReversed().first { predicate(it, it) } + +public fun DataFrame.lastOrNull(): DataRow? = if (nrow > 0) get(nrow - 1) else null + +public fun DataFrame.last(): DataRow { + if (nrow == 0) { + throw NoSuchElementException("DataFrame has no rows. Use `lastOrNull`.") + } + return get(nrow - 1) +} + +// endregion + +// region GroupBy + +public fun GroupBy.last(): ReducedGroupBy = reduce { lastOrNull() } + +public fun GroupBy.last(predicate: RowFilter): ReducedGroupBy = reduce { lastOrNull(predicate) } + +// endregion + +// region Pivot + +public fun Pivot.last(): ReducedPivot = reduce { lastOrNull() } + +public fun Pivot.last(predicate: RowFilter): ReducedPivot = reduce { lastOrNull(predicate) } + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.last(): ReducedPivotGroupBy = reduce { lastOrNull() } + +public fun PivotGroupBy.last(predicate: RowFilter): ReducedPivotGroupBy = reduce { lastOrNull(predicate) } + +// endregion + +// region ColumnsSelectionDsl + +/** + * # Last (Col) [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface LastColumnsSelectionDsl { + + /** + * ## Last (Col) Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`last`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.last]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`last`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.last]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`lastCol`**][org.jetbrains.kotlinx.dataframe.api.LastColumnsSelectionDsl.lastCol]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`last`**][ColumnsSelectionDsl.last] */ + public interface PlainDslName + + /** __`.`__[**`last`**][ColumnsSelectionDsl.last] */ + public interface ColumnSetName + + /** __`.`__[**`lastCol`**][ColumnsSelectionDsl.lastCol] */ + public interface ColumnGroupName + } + + /** + * ## Last (Col) + * Returns the last column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][ColumnGroup], `last` is named `lastCol` instead to avoid confusion. + * + * ### Check out: [Grammar] + * + * #### Examples: + * + * `df.`[select][DataFrame.select]` { `[last][ColumnsSelectionDsl.last]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[lastCol][String.lastCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * + * + * @param [condition] The optional [ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn] containing the last column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.first] + */ + private interface CommonLastDocs { + + /** Examples key */ + interface Examples + } + + /** + * ## Last (Col) + * Returns the last column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `last` is named `lastCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.LastColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[last][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.last]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[lastCol][kotlin.String.lastCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[last][ColumnSet.last]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>().`[last][ColumnSet.last]`() }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the last column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.first] + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.last(condition: ColumnFilter = { true }): TransformableSingleColumn = + (allColumnsInternal() as TransformableColumnSet) + .transform { listOf(it.last(condition)) } + .singleOrNullWithTransformerImpl() + + /** + * ## Last (Col) + * Returns the last column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `last` is named `lastCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.LastColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[last][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.last]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[lastCol][kotlin.String.lastCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[last][ColumnsSelectionDsl.last]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the last column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.first] + */ + public fun ColumnsSelectionDsl<*>.last(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + asSingleColumn().lastCol(condition) + + /** + * ## Last (Col) + * Returns the last column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `last` is named `lastCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.LastColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[last][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.last]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[lastCol][kotlin.String.lastCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[lastCol][SingleColumn.lastCol]`() }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the last column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.first] + */ + public fun SingleColumn>.lastCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + this.ensureIsColumnGroup().asColumnSet().last(condition) + + /** + * ## Last (Col) + * Returns the last column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `last` is named `lastCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.LastColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[last][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.last]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[lastCol][kotlin.String.lastCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[lastCol][String.lastCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the last column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.first] + */ + public fun String.lastCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + columnGroup(this).lastCol(condition) + + /** + * ## Last (Col) + * Returns the last column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `last` is named `lastCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.LastColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[last][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.last]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[lastCol][kotlin.String.lastCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[lastCol][SingleColumn.lastCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[lastCol][KProperty.lastCol]`() }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the last column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.first] + */ + public fun KProperty<*>.lastCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + columnGroup(this).lastCol(condition) + + /** + * ## Last (Col) + * Returns the last column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup], `last` is named `lastCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.LastColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[last][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.last]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[lastCol][kotlin.String.lastCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[lastCol][ColumnPath.lastCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the last column + * that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @see [ColumnsSelectionDsl.first] + */ + public fun ColumnPath.lastCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + columnGroup(this).lastCol(condition) +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/length.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/length.kt new file mode 100644 index 000000000..3c9eb65af --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/length.kt @@ -0,0 +1,10 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.StringCol + +// region StringCol + +public fun StringCol.length(): DataColumn = map { it?.length ?: 0 } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/lowercase.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/lowercase.kt new file mode 100644 index 000000000..1f10f5991 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/lowercase.kt @@ -0,0 +1,9 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.StringCol + +// region StringCol + +public fun StringCol.lowercase(): StringCol = map { it?.lowercase() } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/map.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/map.kt new file mode 100644 index 000000000..6907c9e0b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/map.kt @@ -0,0 +1,132 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.ColumnsContainer +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.Selector +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.columns.createComputedColumnReference +import org.jetbrains.kotlinx.dataframe.impl.columns.newColumn +import kotlin.reflect.KProperty +import kotlin.reflect.KType +import kotlin.reflect.typeOf + +// region ColumnReference + +public inline fun ColumnReference.map( + infer: Infer = Infer.Nulls, + noinline transform: (C) -> R, +): ColumnReference = createComputedColumnReference(name(), typeOf(), infer) { transform(this@map()) } + +// endregion + +// region DataColumn + +public inline fun DataColumn.map( + infer: Infer = Infer.Nulls, + crossinline transform: (T) -> R, +): DataColumn { + val newValues = Array(size()) { transform(get(it)) }.asList() + return DataColumn.create(name(), newValues, typeOf(), infer) +} + +public fun DataColumn.map(type: KType, infer: Infer = Infer.Nulls, transform: (T) -> R): DataColumn { + val values = Array(size()) { transform(get(it)) }.asList() + return DataColumn.create(name(), values, type, infer).cast() +} + +public inline fun DataColumn.mapIndexed( + infer: Infer = Infer.Nulls, + crossinline transform: (Int, T) -> R, +): DataColumn { + val newValues = Array(size()) { transform(it, get(it)) }.asList() + return DataColumn.create(name(), newValues, typeOf(), infer) +} + +public fun DataColumn.mapIndexed( + type: KType, + infer: Infer = Infer.Nulls, + transform: (Int, T) -> R, +): DataColumn { + val values = Array(size()) { transform(it, get(it)) }.asList() + return DataColumn.create(name(), values, type, infer).cast() +} + +// endregion + +// region DataFrame + +public fun DataFrame.map(transform: RowExpression): List = rows().map { transform(it, it) } + +public inline fun ColumnsContainer.mapToColumn( + name: String, + infer: Infer = Infer.Nulls, + noinline body: AddExpression, +): DataColumn = mapToColumn(name, typeOf(), infer, body) + +public inline fun ColumnsContainer.mapToColumn( + column: ColumnReference, + infer: Infer = Infer.Nulls, + noinline body: AddExpression, +): DataColumn = mapToColumn(column, typeOf(), infer, body) + +public inline fun ColumnsContainer.mapToColumn( + column: KProperty, + infer: Infer = Infer.Nulls, + noinline body: AddExpression, +): DataColumn = mapToColumn(column, typeOf(), infer, body) + +public fun ColumnsContainer.mapToColumn( + name: String, + type: KType, + infer: Infer = Infer.Nulls, + body: AddExpression, +): DataColumn = newColumn(type, name, infer, body) + +public fun ColumnsContainer.mapToColumn( + column: ColumnReference, + type: KType, + infer: Infer = Infer.Nulls, + body: AddExpression, +): DataColumn = mapToColumn(column.name(), type, infer, body) + +public fun ColumnsContainer.mapToColumn( + column: KProperty, + type: KType, + infer: Infer = Infer.Nulls, + body: AddExpression, +): DataColumn = mapToColumn(column.columnName, type, infer, body) + +@Refine +@Interpretable("MapToFrame") +public fun DataFrame.mapToFrame(body: AddDsl.() -> Unit): AnyFrame { + val dsl = AddDsl(this) + body(dsl) + return dataFrameOf(dsl.columns) +} + +// endregion + +// region GroupBy + +public fun GroupBy.map(body: Selector, R>): List = + keys.rows().mapIndexedNotNull { index, row -> + val group = groups[index] + val g = GroupWithKey(row, group) + body(g, g) + } + +public fun GroupBy.mapToRows(body: Selector, DataRow?>): DataFrame = + map(body).concat() + +public fun GroupBy.mapToFrames(body: Selector, DataFrame>): FrameColumn = + DataColumn.createFrameColumn(groups.name, map(body)) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/matches.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/matches.kt new file mode 100644 index 000000000..7b554dc53 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/matches.kt @@ -0,0 +1,11 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame + +// region PivotGroupBy + +public fun PivotGroupBy.matches(): DataFrame = matches(yes = true, no = false) + +public fun PivotGroupBy.matches(yes: R, no: R): DataFrame = aggregate { yes default no } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/max.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/max.kt new file mode 100644 index 000000000..59b34e856 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/max.kt @@ -0,0 +1,267 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.aggregation.ColumnsForAggregateSelector +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.columns.values +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.Aggregators +import org.jetbrains.kotlinx.dataframe.impl.aggregation.comparableColumns +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateAll +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateFor +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateOfDelegated +import org.jetbrains.kotlinx.dataframe.impl.columns.toComparableColumns +import org.jetbrains.kotlinx.dataframe.impl.indexOfMax +import org.jetbrains.kotlinx.dataframe.impl.suggestIfNull +import kotlin.reflect.KProperty + +// region DataColumn + +public fun > DataColumn.max(): T = maxOrNull().suggestIfNull("max") + +public fun > DataColumn.maxOrNull(): T? = asSequence().filterNotNull().maxOrNull() + +public fun > DataColumn.maxBy(selector: (T) -> R): T = + maxByOrNull(selector).suggestIfNull("maxBy") + +public fun > DataColumn.maxByOrNull(selector: (T) -> R): T? = values.maxByOrNull(selector) + +public fun > DataColumn.maxOf(selector: (T) -> R): R = + maxOfOrNull(selector).suggestIfNull("maxOf") + +public fun > DataColumn.maxOfOrNull(selector: (T) -> R): R? = values.maxOfOrNull(selector) + +// endregion + +// region DataRow + +public fun AnyRow.rowMaxOrNull(): Any? = values().filterIsInstance>().maxWithOrNull(compareBy { it }) + +public fun AnyRow.rowMax(): Any = rowMaxOrNull().suggestIfNull("rowMax") + +public inline fun > AnyRow.rowMaxOfOrNull(): T? = values().filterIsInstance().maxOrNull() + +public inline fun > AnyRow.rowMaxOf(): T = rowMaxOfOrNull().suggestIfNull("rowMaxOf") + +// endregion + +// region DataFrame + +public fun DataFrame.max(): DataRow = maxFor(comparableColumns()) + +public fun > DataFrame.maxFor(columns: ColumnsForAggregateSelector): DataRow = + Aggregators.max.aggregateFor(this, columns) + +public fun DataFrame.maxFor(vararg columns: String): DataRow = maxFor { columns.toComparableColumns() } + +public fun > DataFrame.maxFor(vararg columns: ColumnReference): DataRow = + maxFor { columns.toColumnSet() } + +public fun > DataFrame.maxFor(vararg columns: KProperty): DataRow = + maxFor { columns.toColumnSet() } + +public fun > DataFrame.max(columns: ColumnsSelector): C = + maxOrNull(columns).suggestIfNull("max") + +public fun DataFrame.max(vararg columns: String): Comparable = maxOrNull(*columns).suggestIfNull("max") + +public fun > DataFrame.max(vararg columns: ColumnReference): C = + maxOrNull(*columns).suggestIfNull("max") + +public fun > DataFrame.max(vararg columns: KProperty): C = + maxOrNull(*columns).suggestIfNull("max") + +public fun > DataFrame.maxOrNull(columns: ColumnsSelector): C? = + Aggregators.max.aggregateAll(this, columns) as C? + +public fun DataFrame.maxOrNull(vararg columns: String): Comparable? = + maxOrNull { columns.toComparableColumns() } + +public fun > DataFrame.maxOrNull(vararg columns: ColumnReference): C? = + maxOrNull { columns.toColumnSet() } + +public fun > DataFrame.maxOrNull(vararg columns: KProperty): C? = + maxOrNull { columns.toColumnSet() } + +public fun > DataFrame.maxOf(expression: RowExpression): C = + maxOfOrNull(expression).suggestIfNull("maxOf") + +public fun > DataFrame.maxOfOrNull(expression: RowExpression): C? = + rows().maxOfOrNull { expression(it, it) } + +public fun > DataFrame.maxBy(expression: RowExpression): DataRow = + maxByOrNull(expression).suggestIfNull("maxBy") + +public fun DataFrame.maxBy(column: String): DataRow = maxByOrNull(column).suggestIfNull("maxBy") + +public fun > DataFrame.maxBy(column: ColumnReference): DataRow = + maxByOrNull(column).suggestIfNull("maxBy") + +public fun > DataFrame.maxBy(column: KProperty): DataRow = + maxByOrNull(column).suggestIfNull("maxBy") + +public fun > DataFrame.maxByOrNull(expression: RowExpression): DataRow? = + getOrNull(rows().asSequence().map { expression(it, it) }.indexOfMax()) + +public fun DataFrame.maxByOrNull(column: String): DataRow? = + maxByOrNull(column.toColumnOf?>()) + +public fun > DataFrame.maxByOrNull(column: ColumnReference): DataRow? = + getOrNull(get(column).asSequence().indexOfMax()) + +public fun > DataFrame.maxByOrNull(column: KProperty): DataRow? = + maxByOrNull(column.toColumnAccessor()) + +// endregion + +// region GroupBy + +public fun Grouped.max(): DataFrame = maxFor(comparableColumns()) + +public fun > Grouped.maxFor(columns: ColumnsForAggregateSelector): DataFrame = + Aggregators.max.aggregateFor(this, columns) + +public fun Grouped.maxFor(vararg columns: String): DataFrame = maxFor { columns.toComparableColumns() } + +public fun > Grouped.maxFor(vararg columns: ColumnReference): DataFrame = + maxFor { columns.toColumnSet() } + +public fun > Grouped.maxFor(vararg columns: KProperty): DataFrame = + maxFor { columns.toColumnSet() } + +public fun > Grouped.max(name: String? = null, columns: ColumnsSelector): DataFrame = + Aggregators.max.aggregateAll(this, name, columns) + +public fun Grouped.max(vararg columns: String, name: String? = null): DataFrame = + max(name) { columns.toComparableColumns() } + +public fun > Grouped.max( + vararg columns: ColumnReference, + name: String? = null, +): DataFrame = max(name) { columns.toColumnSet() } + +public fun > Grouped.max(vararg columns: KProperty, name: String? = null): DataFrame = + max(name) { columns.toColumnSet() } + +public fun > Grouped.maxOf( + name: String? = null, + expression: RowExpression, +): DataFrame = Aggregators.max.aggregateOfDelegated(this, name) { maxOfOrNull(expression) } + +public fun > GroupBy.maxBy(rowExpression: RowExpression): ReducedGroupBy = + reduce { maxByOrNull(rowExpression) } + +public fun > GroupBy.maxBy(column: ColumnReference): ReducedGroupBy = + reduce { maxByOrNull(column) } + +public fun GroupBy.maxBy(column: String): ReducedGroupBy = + maxBy(column.toColumnAccessor().cast>()) + +public fun > GroupBy.maxBy(column: KProperty): ReducedGroupBy = + maxBy(column.toColumnAccessor()) + +// endregion + +// region Pivot + +public fun Pivot.max(separate: Boolean = false): DataRow = delegate { max(separate) } + +public fun > Pivot.maxFor( + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataRow = delegate { maxFor(separate, columns) } + +public fun Pivot.maxFor(vararg columns: String, separate: Boolean = false): DataRow = + maxFor(separate) { columns.toComparableColumns() } + +public fun > Pivot.maxFor( + vararg columns: ColumnReference, + separate: Boolean = false, +): DataRow = maxFor(separate) { columns.toColumnSet() } + +public fun > Pivot.maxFor( + vararg columns: KProperty, + separate: Boolean = false, +): DataRow = maxFor(separate) { columns.toColumnSet() } + +public fun > Pivot.max(columns: ColumnsSelector): DataRow = delegate { max(columns) } + +public fun Pivot.max(vararg columns: String): DataRow = max { columns.toComparableColumns() } + +public fun > Pivot.max(vararg columns: ColumnReference): DataRow = + max { columns.toColumnSet() } + +public fun > Pivot.max(vararg columns: KProperty): DataRow = + max { columns.toColumnSet() } + +public fun > Pivot.maxOf(rowExpression: RowExpression): DataRow = + delegate { maxOf(rowExpression) } + +public fun > Pivot.maxBy(rowExpression: RowExpression): ReducedPivot = + reduce { maxByOrNull(rowExpression) } + +public fun > Pivot.maxBy(column: ColumnReference): ReducedPivot = + reduce { maxByOrNull(column) } + +public fun Pivot.maxBy(column: String): ReducedPivot = + maxBy(column.toColumnAccessor().cast>()) + +public fun > Pivot.maxBy(column: KProperty): ReducedPivot = + maxBy(column.toColumnAccessor()) + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.max(separate: Boolean = false): DataFrame = maxFor(separate, comparableColumns()) + +public fun > PivotGroupBy.maxFor( + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataFrame = Aggregators.max.aggregateFor(this, separate, columns) + +public fun PivotGroupBy.maxFor(vararg columns: String, separate: Boolean = false): DataFrame = + maxFor(separate) { columns.toComparableColumns() } + +public fun > PivotGroupBy.maxFor( + vararg columns: ColumnReference, + separate: Boolean = false, +): DataFrame = maxFor(separate) { columns.toColumnSet() } + +public fun > PivotGroupBy.maxFor( + vararg columns: KProperty, + separate: Boolean = false, +): DataFrame = maxFor(separate) { columns.toColumnSet() } + +public fun > PivotGroupBy.max(columns: ColumnsSelector): DataFrame = + Aggregators.max.aggregateAll(this, columns) + +public fun PivotGroupBy.max(vararg columns: String): DataFrame = max { columns.toComparableColumns() } + +public fun > PivotGroupBy.max(vararg columns: ColumnReference): DataFrame = + max { columns.toColumnSet() } + +public fun > PivotGroupBy.max(vararg columns: KProperty): DataFrame = + max { columns.toColumnSet() } + +public fun > PivotGroupBy.maxOf(rowExpression: RowExpression): DataFrame = + aggregate { maxOf(rowExpression) } + +public fun > PivotGroupBy.maxBy(rowExpression: RowExpression): ReducedPivotGroupBy = + reduce { maxByOrNull(rowExpression) } + +public fun > PivotGroupBy.maxBy(column: ColumnReference): ReducedPivotGroupBy = + reduce { maxByOrNull(column) } + +public fun PivotGroupBy.maxBy(column: String): ReducedPivotGroupBy = + maxBy(column.toColumnAccessor().cast>()) + +public fun > PivotGroupBy.maxBy(column: KProperty): ReducedPivotGroupBy = + maxBy(column.toColumnAccessor()) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/mean.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/mean.kt new file mode 100644 index 000000000..81309e7d7 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/mean.kt @@ -0,0 +1,242 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.aggregation.ColumnsForAggregateSelector +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.columns.toColumnsSetOf +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.Aggregators +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.cast2 +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateAll +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateFor +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateOf +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.of +import org.jetbrains.kotlinx.dataframe.impl.aggregation.numberColumns +import org.jetbrains.kotlinx.dataframe.impl.columns.toNumberColumns +import org.jetbrains.kotlinx.dataframe.impl.suggestIfNull +import org.jetbrains.kotlinx.dataframe.math.mean +import kotlin.reflect.KProperty +import kotlin.reflect.typeOf + +// region DataColumn + +public fun DataColumn.mean(skipNA: Boolean = skipNA_default): Double = + meanOrNull(skipNA).suggestIfNull("mean") + +public fun DataColumn.meanOrNull(skipNA: Boolean = skipNA_default): Double? = + Aggregators.mean(skipNA).aggregate(this) + +public inline fun DataColumn.meanOf( + skipNA: Boolean = skipNA_default, + noinline expression: (T) -> R?, +): Double = Aggregators.mean(skipNA).cast2().aggregateOf(this, expression) ?: Double.NaN + +// endregion + +// region DataRow + +public fun AnyRow.rowMean(skipNA: Boolean = skipNA_default): Double = + values().filterIsInstance().map { it.toDouble() }.mean(skipNA) + +public inline fun AnyRow.rowMeanOf(): Double = values().filterIsInstance().mean(typeOf()) + +// endregion + +// region DataFrame + +public fun DataFrame.mean(skipNA: Boolean = skipNA_default): DataRow = meanFor(skipNA, numberColumns()) + +public fun DataFrame.meanFor( + skipNA: Boolean = skipNA_default, + columns: ColumnsForAggregateSelector, +): DataRow = Aggregators.mean(skipNA).aggregateFor(this, columns) + +public fun DataFrame.meanFor(vararg columns: String, skipNA: Boolean = skipNA_default): DataRow = + meanFor(skipNA) { columns.toNumberColumns() } + +public fun DataFrame.meanFor( + vararg columns: ColumnReference, + skipNA: Boolean = skipNA_default, +): DataRow = meanFor(skipNA) { columns.toColumnSet() } + +public fun DataFrame.meanFor( + vararg columns: KProperty, + skipNA: Boolean = skipNA_default, +): DataRow = meanFor(skipNA) { columns.toColumnSet() } + +public fun DataFrame.mean( + skipNA: Boolean = skipNA_default, + columns: ColumnsSelector, +): Double = Aggregators.mean(skipNA).aggregateAll(this, columns) as Double? ?: Double.NaN + +public fun DataFrame.mean(vararg columns: String, skipNA: Boolean = skipNA_default): Double = + mean(skipNA) { columns.toNumberColumns() } + +public fun DataFrame.mean( + vararg columns: ColumnReference, + skipNA: Boolean = skipNA_default, +): Double = mean(skipNA) { columns.toColumnSet() } + +public fun DataFrame.mean(vararg columns: KProperty, skipNA: Boolean = skipNA_default): Double = + mean(skipNA) { columns.toColumnSet() } + +public inline fun DataFrame.meanOf( + skipNA: Boolean = skipNA_default, + noinline expression: RowExpression, +): Double = Aggregators.mean(skipNA).of(this, expression) ?: Double.NaN + +// endregion + +// region GroupBy + +public fun Grouped.mean(skipNA: Boolean = skipNA_default): DataFrame = meanFor(skipNA, numberColumns()) + +public fun Grouped.meanFor( + skipNA: Boolean = skipNA_default, + columns: ColumnsForAggregateSelector, +): DataFrame = Aggregators.mean(skipNA).aggregateFor(this, columns) + +public fun Grouped.meanFor(vararg columns: String, skipNA: Boolean = skipNA_default): DataFrame = + meanFor(skipNA) { columns.toNumberColumns() } + +public fun Grouped.meanFor( + vararg columns: ColumnReference, + skipNA: Boolean = skipNA_default, +): DataFrame = meanFor(skipNA) { columns.toColumnSet() } + +public fun Grouped.meanFor( + vararg columns: KProperty, + skipNA: Boolean = skipNA_default, +): DataFrame = meanFor(skipNA) { columns.toColumnSet() } + +public fun Grouped.mean( + name: String? = null, + skipNA: Boolean = skipNA_default, + columns: ColumnsSelector, +): DataFrame = Aggregators.mean(skipNA).aggregateAll(this, name, columns) + +public fun Grouped.mean( + vararg columns: String, + name: String? = null, + skipNA: Boolean = skipNA_default, +): DataFrame = mean(name, skipNA) { columns.toNumberColumns() } + +public fun Grouped.mean( + vararg columns: ColumnReference, + name: String? = null, + skipNA: Boolean = skipNA_default, +): DataFrame = mean(name, skipNA) { columns.toColumnSet() } + +public fun Grouped.mean( + vararg columns: KProperty, + name: String? = null, + skipNA: Boolean = skipNA_default, +): DataFrame = mean(name, skipNA) { columns.toColumnSet() } + +public inline fun Grouped.meanOf( + name: String? = null, + skipNA: Boolean = skipNA_default, + crossinline expression: RowExpression, +): DataFrame = Aggregators.mean(skipNA).aggregateOf(this, name, expression) + +// endregion + +// region Pivot + +public fun Pivot.mean(skipNA: Boolean = skipNA_default, separate: Boolean = false): DataRow = + meanFor(skipNA, separate, numberColumns()) + +public fun Pivot.meanFor( + skipNA: Boolean = skipNA_default, + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataRow = delegate { meanFor(skipNA, separate, columns) } + +public fun Pivot.meanFor( + vararg columns: String, + skipNA: Boolean = skipNA_default, + separate: Boolean = false, +): DataRow = meanFor(skipNA, separate) { columns.toNumberColumns() } + +public fun Pivot.meanFor( + vararg columns: ColumnReference, + skipNA: Boolean = skipNA_default, + separate: Boolean = false, +): DataRow = meanFor(skipNA, separate) { columns.toColumnSet() } + +public fun Pivot.meanFor( + vararg columns: KProperty, + skipNA: Boolean = skipNA_default, + separate: Boolean = false, +): DataRow = meanFor(skipNA, separate) { columns.toColumnSet() } + +public fun Pivot.mean( + skipNA: Boolean = skipNA_default, + columns: ColumnsSelector, +): DataRow = delegate { mean(skipNA, columns) } + +public inline fun Pivot.meanOf( + skipNA: Boolean = skipNA_default, + crossinline expression: RowExpression, +): DataRow = delegate { meanOf(skipNA, expression) } + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.mean(separate: Boolean = false, skipNA: Boolean = skipNA_default): DataFrame = + meanFor(skipNA, separate, numberColumns()) + +public fun PivotGroupBy.meanFor( + skipNA: Boolean = skipNA_default, + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataFrame = Aggregators.mean(skipNA).aggregateFor(this, separate, columns) + +public fun PivotGroupBy.meanFor( + vararg columns: String, + separate: Boolean = false, + skipNA: Boolean = skipNA_default, +): DataFrame = meanFor(skipNA, separate) { columns.toNumberColumns() } + +public fun PivotGroupBy.meanFor( + vararg columns: ColumnReference, + separate: Boolean = false, + skipNA: Boolean = skipNA_default, +): DataFrame = meanFor(skipNA, separate) { columns.toColumnSet() } + +public fun PivotGroupBy.meanFor( + vararg columns: KProperty, + separate: Boolean = false, + skipNA: Boolean = skipNA_default, +): DataFrame = meanFor(skipNA, separate) { columns.toColumnSet() } + +public fun PivotGroupBy.mean( + skipNA: Boolean = skipNA_default, + columns: ColumnsSelector, +): DataFrame = Aggregators.mean(skipNA).aggregateAll(this, columns) + +public fun PivotGroupBy.mean(vararg columns: String, skipNA: Boolean = skipNA_default): DataFrame = + mean(skipNA) { columns.toColumnsSetOf() } + +public fun PivotGroupBy.mean( + vararg columns: ColumnReference, + skipNA: Boolean = skipNA_default, +): DataFrame = mean(skipNA) { columns.toColumnSet() } + +public fun PivotGroupBy.mean( + vararg columns: KProperty, + skipNA: Boolean = skipNA_default, +): DataFrame = mean(skipNA) { columns.toColumnSet() } + +public inline fun PivotGroupBy.meanOf( + skipNA: Boolean = skipNA_default, + crossinline expression: RowExpression, +): DataFrame = Aggregators.mean(skipNA).aggregateOf(this, expression) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/median.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/median.kt new file mode 100644 index 000000000..fb57e33d7 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/median.kt @@ -0,0 +1,212 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.aggregation.ColumnsForAggregateSelector +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.Aggregators +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.cast +import org.jetbrains.kotlinx.dataframe.impl.aggregation.comparableColumns +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateAll +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateFor +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateOf +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.of +import org.jetbrains.kotlinx.dataframe.impl.columns.toComparableColumns +import org.jetbrains.kotlinx.dataframe.impl.suggestIfNull +import org.jetbrains.kotlinx.dataframe.math.medianOrNull +import kotlin.reflect.KProperty + +// region DataColumn + +public fun > DataColumn.median(): T = medianOrNull().suggestIfNull("median") + +public fun > DataColumn.medianOrNull(): T? = Aggregators.median.cast().aggregate(this) + +public inline fun > DataColumn.medianOfOrNull(noinline expression: (T) -> R?): R? = + Aggregators.median.cast().aggregateOf(this, expression) + +public inline fun > DataColumn.medianOf(noinline expression: (T) -> R?): R = + medianOfOrNull(expression).suggestIfNull("medianOf") + +// endregion + +// region DataRow + +public fun AnyRow.rowMedianOrNull(): Any? = + Aggregators.median.aggregateMixed( + values().filterIsInstance>().asIterable(), + ) + +public fun AnyRow.rowMedian(): Any = rowMedianOrNull().suggestIfNull("rowMedian") + +public inline fun > AnyRow.rowMedianOfOrNull(): T? = valuesOf().medianOrNull() + +public inline fun > AnyRow.rowMedianOf(): T = + rowMedianOfOrNull().suggestIfNull("rowMedianOf") + +// endregion + +// region DataFrame + +public fun DataFrame.median(): DataRow = medianFor(comparableColumns()) + +public fun > DataFrame.medianFor(columns: ColumnsForAggregateSelector): DataRow = + Aggregators.median.aggregateFor(this, columns) + +public fun DataFrame.medianFor(vararg columns: String): DataRow = medianFor { columns.toComparableColumns() } + +public fun > DataFrame.medianFor(vararg columns: ColumnReference): DataRow = + medianFor { columns.toColumnSet() } + +public fun > DataFrame.medianFor(vararg columns: KProperty): DataRow = + medianFor { columns.toColumnSet() } + +public fun > DataFrame.median(columns: ColumnsSelector): C = + medianOrNull(columns).suggestIfNull("median") + +public fun DataFrame.median(vararg columns: String): Any = median { columns.toComparableColumns() } + +public fun > DataFrame.median(vararg columns: ColumnReference): C = + median { columns.toColumnSet() } + +public fun > DataFrame.median(vararg columns: KProperty): C = + median { columns.toColumnSet() } + +public fun > DataFrame.medianOrNull(columns: ColumnsSelector): C? = + Aggregators.median.aggregateAll(this, columns) as C? + +public fun DataFrame.medianOrNull(vararg columns: String): Any? = medianOrNull { columns.toComparableColumns() } + +public fun > DataFrame.medianOrNull(vararg columns: ColumnReference): C? = + medianOrNull { columns.toColumnSet() } + +public fun > DataFrame.medianOrNull(vararg columns: KProperty): C? = + medianOrNull { columns.toColumnSet() } + +public inline fun > DataFrame.medianOf( + crossinline expression: RowExpression, +): R? = Aggregators.median.of(this, expression) as R? + +// endregion + +// region GroupBy + +public fun Grouped.median(): DataFrame = medianFor(comparableColumns()) + +public fun > Grouped.medianFor(columns: ColumnsForAggregateSelector): DataFrame = + Aggregators.median.aggregateFor(this, columns) + +public fun Grouped.medianFor(vararg columns: String): DataFrame = medianFor { columns.toComparableColumns() } + +public fun > Grouped.medianFor(vararg columns: ColumnReference): DataFrame = + medianFor { columns.toColumnSet() } + +public fun > Grouped.medianFor(vararg columns: KProperty): DataFrame = + medianFor { columns.toColumnSet() } + +public fun > Grouped.median( + name: String? = null, + columns: ColumnsSelector, +): DataFrame = Aggregators.median.aggregateAll(this, name, columns) + +public fun Grouped.median(vararg columns: String, name: String? = null): DataFrame = + median(name) { columns.toComparableColumns() } + +public fun > Grouped.median( + vararg columns: ColumnReference, + name: String? = null, +): DataFrame = median(name) { columns.toColumnSet() } + +public fun > Grouped.median(vararg columns: KProperty, name: String? = null): DataFrame = + median(name) { columns.toColumnSet() } + +public inline fun > Grouped.medianOf( + name: String? = null, + crossinline expression: RowExpression, +): DataFrame = Aggregators.median.aggregateOf(this, name, expression) + +// endregion + +// region Pivot + +public fun Pivot.median(separate: Boolean = false): DataRow = medianFor(separate, comparableColumns()) + +public fun > Pivot.medianFor( + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataRow = delegate { medianFor(separate, columns) } + +public fun Pivot.medianFor(vararg columns: String, separate: Boolean = false): DataRow = + medianFor(separate) { columns.toComparableColumns() } + +public fun > Pivot.medianFor( + vararg columns: ColumnReference, + separate: Boolean = false, +): DataRow = medianFor(separate) { columns.toColumnSet() } + +public fun > Pivot.medianFor( + vararg columns: KProperty, + separate: Boolean = false, +): DataRow = medianFor(separate) { columns.toColumnSet() } + +public fun > Pivot.median(columns: ColumnsSelector): DataRow = + delegate { median(columns) } + +public fun Pivot.median(vararg columns: String): DataRow = median { columns.toComparableColumns() } + +public fun > Pivot.median(vararg columns: ColumnReference): DataRow = + median { columns.toColumnSet() } + +public fun > Pivot.median(vararg columns: KProperty): DataRow = + median { columns.toColumnSet() } + +public inline fun > Pivot.medianOf( + crossinline expression: RowExpression, +): DataRow = delegate { medianOf(expression) } + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.median(separate: Boolean = false): DataFrame = + medianFor(separate, comparableColumns()) + +public fun > PivotGroupBy.medianFor( + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataFrame = Aggregators.median.aggregateFor(this, separate, columns) + +public fun PivotGroupBy.medianFor(vararg columns: String, separate: Boolean = false): DataFrame = + medianFor(separate) { columns.toComparableColumns() } + +public fun > PivotGroupBy.medianFor( + vararg columns: ColumnReference, + separate: Boolean = false, +): DataFrame = medianFor(separate) { columns.toColumnSet() } + +public fun > PivotGroupBy.medianFor( + vararg columns: KProperty, + separate: Boolean = false, +): DataFrame = medianFor(separate) { columns.toColumnSet() } + +public fun > PivotGroupBy.median(columns: ColumnsSelector): DataFrame = + Aggregators.median.aggregateAll(this, columns) + +public fun PivotGroupBy.median(vararg columns: String): DataFrame = median { columns.toComparableColumns() } + +public fun > PivotGroupBy.median(vararg columns: ColumnReference): DataFrame = + median { columns.toColumnSet() } + +public fun > PivotGroupBy.median(vararg columns: KProperty): DataFrame = + median { columns.toColumnSet() } + +public inline fun > PivotGroupBy.medianOf( + crossinline expression: RowExpression, +): DataFrame = Aggregators.median.aggregateOf(this, expression) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/merge.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/merge.kt new file mode 100644 index 000000000..1dd19d24c --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/merge.kt @@ -0,0 +1,110 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.removeImpl +import org.jetbrains.kotlinx.dataframe.impl.api.withRowCellImpl +import org.jetbrains.kotlinx.dataframe.impl.nameGenerator +import kotlin.reflect.KProperty +import kotlin.reflect.KType +import kotlin.reflect.typeOf + +public fun DataFrame.merge(selector: ColumnsSelector): Merge> = + Merge(this, selector, false, { it }, typeOf(), Infer.Type) + +public fun DataFrame.merge(vararg columns: String): Merge> = merge { columns.toColumnSet() } + +public inline fun DataFrame.merge(vararg columns: ColumnReference): Merge> = + merge { columns.toColumnSet() } + +public inline fun DataFrame.merge(vararg columns: KProperty): Merge> = + merge { columns.toColumnSet() } + +public data class Merge( + @PublishedApi + internal val df: DataFrame, + @PublishedApi + internal val selector: ColumnsSelector, + @PublishedApi + internal val notNull: Boolean, + @PublishedApi + internal val transform: DataRow.(List) -> R, + @PublishedApi + internal val resultType: KType, + @PublishedApi + internal val infer: Infer, +) + +public fun Merge.notNull(): Merge = copy(notNull = true) + +public fun Merge.into(columnName: String): DataFrame = into(pathOf(columnName)) + +public fun Merge.into(column: ColumnAccessor<*>): DataFrame = into(column.path()) + +public fun Merge.intoList(): List = + df.select(selector).rows().map { transform(it, it.values() as List) } + +public fun Merge.into(path: ColumnPath): DataFrame { + // If target path exists, merge into temp path + val mergePath = if (df.getColumnOrNull(path) != null) pathOf(nameGenerator().addUnique("temp")) else path + + // move columns into group + val grouped = df.move(selector).under { mergePath } + + var res = grouped.convert { getColumnGroup(mergePath) }.withRowCellImpl(resultType, infer) { + val srcRow = df[index()] + var values = it.values() as List + if (notNull) { + values = values.filter { + it != null && (it !is AnyRow || !it.isEmpty()) + } + } + transform(srcRow, values) + } + if (mergePath != path) { + // target path existed before merge, but + // it may have already been removed + res = res + .removeImpl(allowMissingColumns = true) { path } + .df + .move(mergePath).into { path } + } + return res +} + +public fun Merge.asStrings(): Merge = by(", ") + +public fun Merge.by( + separator: CharSequence = ", ", + prefix: CharSequence = "", + postfix: CharSequence = "", + limit: Int = -1, + truncated: CharSequence = "...", +): Merge = + Merge( + df = df, + selector = selector, + notNull = notNull, + transform = { + it.joinToString( + separator = separator, + prefix = prefix, + postfix = postfix, + limit = limit, + truncated = truncated, + ) + }, + resultType = typeOf(), + infer = Infer.Nulls, + ) + +public inline fun Merge.by( + infer: Infer = Infer.Nulls, + crossinline transform: DataRow.(R) -> V, +): Merge = Merge(df, selector, notNull, { transform(this@by.transform(this, it)) }, typeOf(), infer) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/min.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/min.kt new file mode 100644 index 000000000..2ec4be894 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/min.kt @@ -0,0 +1,268 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.aggregation.ColumnsForAggregateSelector +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.columns.values +import org.jetbrains.kotlinx.dataframe.impl.aggregation.aggregators.Aggregators +import org.jetbrains.kotlinx.dataframe.impl.aggregation.comparableColumns +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateAll +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateFor +import org.jetbrains.kotlinx.dataframe.impl.aggregation.modes.aggregateOfDelegated +import org.jetbrains.kotlinx.dataframe.impl.columns.toComparableColumns +import org.jetbrains.kotlinx.dataframe.impl.indexOfMin +import org.jetbrains.kotlinx.dataframe.impl.suggestIfNull +import kotlin.reflect.KProperty + +// region DataColumn + +public fun > DataColumn.min(): T = minOrNull().suggestIfNull("min") + +public fun > DataColumn.minOrNull(): T? = asSequence().filterNotNull().minOrNull() + +public fun > DataColumn.minBy(selector: (T) -> R): T = + minByOrNull(selector).suggestIfNull("minBy") + +public fun > DataColumn.minByOrNull(selector: (T) -> R): T? = values.minByOrNull(selector) + +public fun > DataColumn.minOf(selector: (T) -> R): R = + minOfOrNull(selector).suggestIfNull("minOf") + +public fun > DataColumn.minOfOrNull(selector: (T) -> R): R? = values.minOfOrNull(selector) + +// endregion + +// region DataRow + +public fun AnyRow.rowMinOrNull(): Any? = values().filterIsInstance>().minWithOrNull(compareBy { it }) + +public fun AnyRow.rowMin(): Any = rowMinOrNull().suggestIfNull("rowMin") + +public inline fun > AnyRow.rowMinOfOrNull(): T? = values().filterIsInstance().minOrNull() + +public inline fun > AnyRow.rowMinOf(): T = rowMinOfOrNull().suggestIfNull("rowMinOf") + +// endregion + +// region DataFrame + +public fun DataFrame.min(): DataRow = minFor(comparableColumns()) + +public fun > DataFrame.minFor(columns: ColumnsForAggregateSelector): DataRow = + Aggregators.min.aggregateFor(this, columns) + +public fun DataFrame.minFor(vararg columns: String): DataRow = minFor { columns.toComparableColumns() } + +public fun > DataFrame.minFor(vararg columns: ColumnReference): DataRow = + minFor { columns.toColumnSet() } + +public fun > DataFrame.minFor(vararg columns: KProperty): DataRow = + minFor { columns.toColumnSet() } + +public fun > DataFrame.min(columns: ColumnsSelector): C = + minOrNull(columns).suggestIfNull("min") + +public fun DataFrame.min(vararg columns: String): Comparable = minOrNull(*columns).suggestIfNull("min") + +public fun > DataFrame.min(vararg columns: ColumnReference): C = + minOrNull(*columns).suggestIfNull("min") + +public fun > DataFrame.min(vararg columns: KProperty): C = + minOrNull(*columns).suggestIfNull("min") + +public fun > DataFrame.minOrNull(columns: ColumnsSelector): C? = + Aggregators.min.aggregateAll(this, columns) as C? + +public fun DataFrame.minOrNull(vararg columns: String): Comparable? = + minOrNull { columns.toComparableColumns() } + +public fun > DataFrame.minOrNull(vararg columns: ColumnReference): C? = + minOrNull { columns.toColumnSet() } + +public fun > DataFrame.minOrNull(vararg columns: KProperty): C? = + minOrNull { columns.toColumnSet() } + +public fun > DataFrame.minOf(expression: RowExpression): C = + minOfOrNull(expression).suggestIfNull("minOf") + +public fun > DataFrame.minOfOrNull(expression: RowExpression): C? = + rows().minOfOrNull { expression(it, it) } + +public fun > DataFrame.minBy(expression: RowExpression): DataRow = + minByOrNull(expression).suggestIfNull("minBy") + +public fun DataFrame.minBy(column: String): DataRow = minByOrNull(column).suggestIfNull("minBy") + +public fun > DataFrame.minBy(column: ColumnReference): DataRow = + minByOrNull(column).suggestIfNull("minBy") + +public fun > DataFrame.minBy(column: KProperty): DataRow = + minByOrNull(column).suggestIfNull("minBy") + +public fun > DataFrame.minByOrNull(expression: RowExpression): DataRow? = + getOrNull(rows().asSequence().map { expression(it, it) }.indexOfMin()) + +public fun DataFrame.minByOrNull(column: String): DataRow? = + minByOrNull(column.toColumnOf?>()) + +public fun > DataFrame.minByOrNull(column: ColumnReference): DataRow? = + getOrNull(get(column).asSequence().indexOfMin()) + +public fun > DataFrame.minByOrNull(column: KProperty): DataRow? = + minByOrNull(column.toColumnAccessor()) + +// endregion + +// region GroupBy + +public fun Grouped.min(): DataFrame = minFor(comparableColumns()) + +public fun > Grouped.minFor(columns: ColumnsForAggregateSelector): DataFrame = + Aggregators.min.aggregateFor(this, columns) + +public fun Grouped.minFor(vararg columns: String): DataFrame = minFor { columns.toComparableColumns() } + +public fun > Grouped.minFor(vararg columns: ColumnReference): DataFrame = + minFor { columns.toColumnSet() } + +public fun > Grouped.minFor(vararg columns: KProperty): DataFrame = + minFor { columns.toColumnSet() } + +public fun > Grouped.min(name: String? = null, columns: ColumnsSelector): DataFrame = + Aggregators.min.aggregateAll(this, name, columns) + +public fun Grouped.min(vararg columns: String, name: String? = null): DataFrame = + min(name) { columns.toComparableColumns() } + +public fun > Grouped.min( + vararg columns: ColumnReference, + name: String? = null, +): DataFrame = min(name) { columns.toColumnSet() } + +public fun > Grouped.min(vararg columns: KProperty, name: String? = null): DataFrame = + min(name) { columns.toColumnSet() } + +public fun > Grouped.minOf( + name: String? = null, + expression: RowExpression, +): DataFrame = Aggregators.min.aggregateOfDelegated(this, name) { minOfOrNull(expression) } + +public fun > GroupBy.minBy(rowExpression: RowExpression): ReducedGroupBy = + reduce { minByOrNull(rowExpression) } + +public fun > GroupBy.minBy(column: ColumnReference): ReducedGroupBy = + reduce { minByOrNull(column) } + +public fun GroupBy.minBy(column: String): ReducedGroupBy = + minBy(column.toColumnAccessor().cast>()) + +public fun > GroupBy.minBy(column: KProperty): ReducedGroupBy = + minBy(column.toColumnAccessor()) + +// endregion + +// region Pivot + +public fun Pivot.min(separate: Boolean = false): DataRow = delegate { min(separate) } + +public fun > Pivot.minFor( + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataRow = delegate { minFor(separate, columns) } + +public fun Pivot.minFor(vararg columns: String, separate: Boolean = false): DataRow = + minFor(separate) { columns.toComparableColumns() } + +public fun > Pivot.minFor( + vararg columns: ColumnReference, + separate: Boolean = false, +): DataRow = minFor(separate) { columns.toColumnSet() } + +public fun > Pivot.minFor( + vararg columns: KProperty, + separate: Boolean = false, +): DataRow = minFor(separate) { columns.toColumnSet() } + +public fun > Pivot.min(columns: ColumnsSelector): DataRow = delegate { min(columns) } + +public fun > Pivot.min(vararg columns: String): DataRow = + min { columns.toComparableColumns() } + +public fun > Pivot.min(vararg columns: ColumnReference): DataRow = + min { columns.toColumnSet() } + +public fun > Pivot.min(vararg columns: KProperty): DataRow = + min { columns.toColumnSet() } + +public fun > Pivot.minOf(rowExpression: RowExpression): DataRow = + delegate { minOf(rowExpression) } + +public fun > Pivot.minBy(rowExpression: RowExpression): ReducedPivot = + reduce { minByOrNull(rowExpression) } + +public fun > Pivot.minBy(column: ColumnReference): ReducedPivot = + reduce { minByOrNull(column) } + +public fun Pivot.minBy(column: String): ReducedPivot = + minBy(column.toColumnAccessor().cast>()) + +public fun > Pivot.minBy(column: KProperty): ReducedPivot = + minBy(column.toColumnAccessor()) + +// endregion + +// region PivotGroupBy + +public fun PivotGroupBy.min(separate: Boolean = false): DataFrame = minFor(separate, comparableColumns()) + +public fun > PivotGroupBy.minFor( + separate: Boolean = false, + columns: ColumnsForAggregateSelector, +): DataFrame = Aggregators.min.aggregateFor(this, separate, columns) + +public fun PivotGroupBy.minFor(vararg columns: String, separate: Boolean = false): DataFrame = + minFor(separate) { columns.toComparableColumns() } + +public fun > PivotGroupBy.minFor( + vararg columns: ColumnReference, + separate: Boolean = false, +): DataFrame = minFor(separate) { columns.toColumnSet() } + +public fun > PivotGroupBy.minFor( + vararg columns: KProperty, + separate: Boolean = false, +): DataFrame = minFor(separate) { columns.toColumnSet() } + +public fun > PivotGroupBy.min(columns: ColumnsSelector): DataFrame = + Aggregators.min.aggregateAll(this, columns) + +public fun PivotGroupBy.min(vararg columns: String): DataFrame = min { columns.toComparableColumns() } + +public fun > PivotGroupBy.min(vararg columns: ColumnReference): DataFrame = + min { columns.toColumnSet() } + +public fun > PivotGroupBy.min(vararg columns: KProperty): DataFrame = + min { columns.toColumnSet() } + +public fun > PivotGroupBy.minOf(rowExpression: RowExpression): DataFrame = + aggregate { minOf(rowExpression) } + +public fun > PivotGroupBy.minBy(rowExpression: RowExpression): ReducedPivotGroupBy = + reduce { minByOrNull(rowExpression) } + +public fun > PivotGroupBy.minBy(column: ColumnReference): ReducedPivotGroupBy = + reduce { minByOrNull(column) } + +public fun PivotGroupBy.minBy(column: String): ReducedPivotGroupBy = + minBy(column.toColumnAccessor().cast>()) + +public fun > PivotGroupBy.minBy(column: KProperty): ReducedPivotGroupBy = + minBy(column.toColumnAccessor()) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/move.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/move.kt new file mode 100644 index 000000000..6fd3f3b59 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/move.kt @@ -0,0 +1,162 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnGroupAccessor +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnSelector +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.afterOrBefore +import org.jetbrains.kotlinx.dataframe.impl.api.moveImpl +import org.jetbrains.kotlinx.dataframe.impl.api.moveTo +import org.jetbrains.kotlinx.dataframe.ncol +import kotlin.reflect.KProperty + +// region DataFrame + +// region move + +@Interpretable("Move0") +public fun DataFrame.move(columns: ColumnsSelector): MoveClause = MoveClause(this, columns) + +public fun DataFrame.move(vararg cols: String): MoveClause = move { cols.toColumnSet() } + +public fun DataFrame.move(vararg cols: ColumnReference): MoveClause = move { cols.toColumnSet() } + +public fun DataFrame.move(vararg cols: KProperty): MoveClause = move { cols.toColumnSet() } + +// endregion + +// region moveTo + +public fun DataFrame.moveTo(newColumnIndex: Int, columns: ColumnsSelector): DataFrame = + move(columns).to(newColumnIndex) + +public fun DataFrame.moveTo(newColumnIndex: Int, vararg columns: String): DataFrame = + moveTo(newColumnIndex) { columns.toColumnSet() } + +public fun DataFrame.moveTo(newColumnIndex: Int, vararg columns: AnyColumnReference): DataFrame = + moveTo(newColumnIndex) { columns.toColumnSet() } + +public fun DataFrame.moveTo(newColumnIndex: Int, vararg columns: KProperty<*>): DataFrame = + moveTo(newColumnIndex) { columns.toColumnSet() } + +// endregion + +// region moveToLeft + +public fun DataFrame.moveToLeft(columns: ColumnsSelector): DataFrame = move(columns).toLeft() + +public fun DataFrame.moveToLeft(vararg columns: String): DataFrame = moveToLeft { columns.toColumnSet() } + +public fun DataFrame.moveToLeft(vararg columns: AnyColumnReference): DataFrame = + moveToLeft { columns.toColumnSet() } + +public fun DataFrame.moveToLeft(vararg columns: KProperty<*>): DataFrame = + moveToLeft { columns.toColumnSet() } + +// endregion + +// region moveToRight + +public fun DataFrame.moveToRight(columns: ColumnsSelector): DataFrame = move(columns).toRight() + +public fun DataFrame.moveToRight(vararg columns: String): DataFrame = moveToRight { columns.toColumnSet() } + +public fun DataFrame.moveToRight(vararg columns: AnyColumnReference): DataFrame = + moveToRight { columns.toColumnSet() } + +public fun DataFrame.moveToRight(vararg columns: KProperty<*>): DataFrame = + moveToRight { columns.toColumnSet() } + +// endregion + +// endregion + +// region MoveClause + +// region into + +public fun MoveClause.into( + column: ColumnsSelectionDsl.(ColumnWithPath) -> AnyColumnReference, +): DataFrame = + moveImpl( + under = false, + newPathExpression = column, + ) + +public fun MoveClause.into(column: String): DataFrame = pathOf(column).let { path -> into { path } } + +public fun MoveClause.intoIndexed( + newPathExpression: ColumnsSelectionDsl.(ColumnWithPath, Int) -> AnyColumnReference, +): DataFrame { + var counter = 0 + return into { col -> + newPathExpression(this, col, counter++) + } +} + +// endregion + +// region under + +public fun MoveClause.under(column: String): DataFrame = pathOf(column).let { path -> under { path } } + +public fun MoveClause.under(column: AnyColumnGroupAccessor): DataFrame = + column.path().let { path -> under { path } } + +public fun MoveClause.under( + column: ColumnsSelectionDsl.(ColumnWithPath) -> AnyColumnReference, +): DataFrame = + moveImpl( + under = true, + newPathExpression = column, + ) + +// endregion + +// region to + +public fun MoveClause.to(columnIndex: Int): DataFrame = moveTo(columnIndex) + +@Refine +@Interpretable("ToTop") +public fun MoveClause.toTop( + newColumnName: ColumnsSelectionDsl.(ColumnWithPath) -> String = { it.name() }, +): DataFrame = into { newColumnName(it).toColumnAccessor() } + +// endregion + +// region after + +public fun MoveClause.after(column: ColumnSelector): DataFrame = afterOrBefore(column, true) + +public fun MoveClause.after(column: String): DataFrame = after { column.toColumnAccessor() } + +public fun MoveClause.after(column: AnyColumnReference): DataFrame = after { column } + +public fun MoveClause.after(column: KProperty<*>): DataFrame = after { column.toColumnAccessor() } + +// endregion + +/* TODO: implement 'before' +fun MoveColsClause.before(columnPath: ColumnPath) = before { columnPath.toColumnDef() } +fun MoveColsClause.before(column: Column) = before { column } +fun MoveColsClause.before(column: KProperty<*>) = before { column.toColumnDef() } +fun MoveColsClause.before(column: String) = before { column.toColumnDef() } +fun MoveColsClause.before(column: ColumnSelector) = afterOrBefore(column, false) +*/ + +public fun MoveClause.toLeft(): DataFrame = to(0) + +public fun MoveClause.toRight(): DataFrame = to(df.ncol) + +public class MoveClause(internal val df: DataFrame, internal val columns: ColumnsSelector) { + override fun toString(): String = "MoveClause(df=$df, columns=$columns)" +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/none.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/none.kt new file mode 100644 index 000000000..dc1fe8a99 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/none.kt @@ -0,0 +1,77 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.impl.columns.ColumnsList + +// region ColumnsSelectionDsl + +/** + * ## None [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface NoneColumnsSelectionDsl { + + /** + * ## None Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`none`**][org.jetbrains.kotlinx.dataframe.api.NoneColumnsSelectionDsl.none]**`()`** + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`none`**][ColumnsSelectionDsl.none] */ + public interface PlainDslName + } + + /** + * ## None + * + * Creates an empty [ColumnsResolver] / [ColumnSet], essentially selecting no columns at all. + * + * This is the opposite of [all][ColumnsSelectionDsl.all]. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[groupBy][DataFrame.groupBy]` { `[`none`][none]`() }` + * + * @return An empty [ColumnsResolver]. + */ + public fun none(): ColumnsResolver<*> = ColumnsList(emptyList()) +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/pivot.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/pivot.kt new file mode 100644 index 000000000..16b67b84b --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/pivot.kt @@ -0,0 +1,244 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Selector +import org.jetbrains.kotlinx.dataframe.aggregation.Aggregatable +import org.jetbrains.kotlinx.dataframe.aggregation.AggregateBody +import org.jetbrains.kotlinx.dataframe.aggregation.AggregateGroupedDsl +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.aggregation.PivotGroupByImpl +import org.jetbrains.kotlinx.dataframe.impl.aggregation.PivotImpl +import org.jetbrains.kotlinx.dataframe.impl.aggregation.PivotInAggregateImpl +import org.jetbrains.kotlinx.dataframe.impl.api.PivotChainColumnSet +import kotlin.reflect.KProperty + +public interface PivotDsl : ColumnsSelectionDsl { + + public infix fun ColumnsResolver.then(other: ColumnsResolver): ColumnSet = + PivotChainColumnSet(this, other) + + public infix fun String.then(other: ColumnsResolver): ColumnSet = toColumnOf() then other + + public infix fun ColumnsResolver.then(other: String): ColumnSet = this then other.toColumnOf() + + public infix fun String.then(other: String): ColumnSet = toColumnAccessor() then other.toColumnAccessor() + + public infix fun KProperty.then(other: ColumnsResolver): ColumnSet = toColumnAccessor() then other + + public infix fun ColumnsResolver.then(other: KProperty): ColumnSet = this then other.toColumnAccessor() + + public infix fun KProperty.then(other: KProperty): ColumnSet = + toColumnAccessor() then other.toColumnAccessor() + + public infix fun KProperty.then(other: String): ColumnSet = toColumnAccessor() then other.toColumnOf() + + public infix fun String.then(other: KProperty): ColumnSet = toColumnOf() then other.toColumnAccessor() +} + +// region DataFrame + +// region pivot + +public fun DataFrame.pivot(inward: Boolean? = null, columns: PivotColumnsSelector): Pivot = + PivotImpl(this, columns, inward) + +public fun DataFrame.pivot(vararg columns: String, inward: Boolean? = null): Pivot = + pivot(inward) { columns.toColumnSet() } + +public fun DataFrame.pivot(vararg columns: AnyColumnReference, inward: Boolean? = null): Pivot = + pivot(inward) { columns.toColumnSet() } + +public fun DataFrame.pivot(vararg columns: KProperty<*>, inward: Boolean? = null): Pivot = + pivot(inward) { columns.toColumnSet() } + +// endregion + +// region pivotMatches + +public fun DataFrame.pivotMatches(inward: Boolean = true, columns: ColumnsSelector): DataFrame = + pivot(inward, columns).groupByOther().matches() + +public fun DataFrame.pivotMatches(vararg columns: String, inward: Boolean = true): DataFrame = + pivotMatches(inward) { columns.toColumnSet() } + +public fun DataFrame.pivotMatches(vararg columns: AnyColumnReference, inward: Boolean = true): DataFrame = + pivotMatches(inward) { columns.toColumnSet() } + +public fun DataFrame.pivotMatches(vararg columns: KProperty<*>, inward: Boolean = true): DataFrame = + pivotMatches(inward) { columns.toColumnSet() } + +// endregion + +// region pivotCounts + +public fun DataFrame.pivotCounts(inward: Boolean = true, columns: ColumnsSelector): DataFrame = + pivot(inward, columns).groupByOther().count() + +public fun DataFrame.pivotCounts(vararg columns: String, inward: Boolean = true): DataFrame = + pivotCounts(inward) { columns.toColumnSet() } + +public fun DataFrame.pivotCounts(vararg columns: AnyColumnReference, inward: Boolean = true): DataFrame = + pivotCounts(inward) { columns.toColumnSet() } + +public fun DataFrame.pivotCounts(vararg columns: KProperty<*>, inward: Boolean = true): DataFrame = + pivotCounts(inward) { columns.toColumnSet() } + +// endregion + +// endregion + +// region GroupBy + +// region pivot + +public fun GroupBy<*, G>.pivot(inward: Boolean = true, columns: ColumnsSelector): PivotGroupBy = + PivotGroupByImpl(this, columns, inward) + +public fun GroupBy<*, G>.pivot(vararg columns: AnyColumnReference, inward: Boolean = true): PivotGroupBy = + pivot(inward) { columns.toColumnSet() } + +public fun GroupBy<*, G>.pivot(vararg columns: String, inward: Boolean = true): PivotGroupBy = + pivot(inward) { columns.toColumnSet() } + +public fun GroupBy<*, G>.pivot(vararg columns: KProperty<*>, inward: Boolean = true): PivotGroupBy = + pivot(inward) { columns.toColumnSet() } + +// endregion + +// region pivotMatches + +public fun GroupBy<*, G>.pivotMatches(inward: Boolean = true, columns: ColumnsSelector): DataFrame = + pivot(inward, columns).matches() + +public fun GroupBy<*, G>.pivotMatches(vararg columns: String, inward: Boolean = true): DataFrame = + pivotMatches(inward) { columns.toColumnSet() } + +public fun GroupBy<*, G>.pivotMatches(vararg columns: AnyColumnReference, inward: Boolean = true): DataFrame = + pivotMatches(inward) { columns.toColumnSet() } + +public fun GroupBy<*, G>.pivotMatches(vararg columns: KProperty<*>, inward: Boolean = true): DataFrame = + pivotMatches(inward) { columns.toColumnSet() } + +// endregion + +// region pivotCounts + +public fun GroupBy<*, G>.pivotCounts(inward: Boolean = true, columns: ColumnsSelector): DataFrame = + pivot(inward, columns).count() + +public fun GroupBy<*, G>.pivotCounts(vararg columns: String, inward: Boolean = true): DataFrame = + pivotCounts(inward) { columns.toColumnSet() } + +public fun GroupBy<*, G>.pivotCounts(vararg columns: AnyColumnReference, inward: Boolean = true): DataFrame = + pivotCounts(inward) { columns.toColumnSet() } + +public fun GroupBy<*, G>.pivotCounts(vararg columns: KProperty<*>, inward: Boolean = true): DataFrame = + pivotCounts(inward) { columns.toColumnSet() } + +// endregion + +// endregion + +// region GroupBy.aggregate + +// region pivot + +public fun AggregateGroupedDsl.pivot( + inward: Boolean = true, + columns: PivotColumnsSelector, +): PivotGroupBy = PivotInAggregateImpl(this, columns, inward) + +public fun AggregateGroupedDsl.pivot(vararg columns: String, inward: Boolean = true): PivotGroupBy = + pivot(inward) { columns.toColumnSet() } + +public fun AggregateGroupedDsl.pivot( + vararg columns: AnyColumnReference, + inward: Boolean = true, +): PivotGroupBy = pivot(inward) { columns.toColumnSet() } + +public fun AggregateGroupedDsl.pivot(vararg columns: KProperty<*>, inward: Boolean = true): PivotGroupBy = + pivot(inward) { columns.toColumnSet() } + +// endregion + +// region pivotMatches + +public fun AggregateGroupedDsl.pivotMatches( + inward: Boolean = true, + columns: ColumnsSelector, +): DataFrame = pivot(inward, columns).matches() + +public fun AggregateGroupedDsl.pivotMatches(vararg columns: String, inward: Boolean = true): DataFrame = + pivotMatches(inward) { columns.toColumnSet() } + +public fun AggregateGroupedDsl.pivotMatches( + vararg columns: AnyColumnReference, + inward: Boolean = true, +): DataFrame = pivotMatches(inward) { columns.toColumnSet() } + +public fun AggregateGroupedDsl.pivotMatches(vararg columns: KProperty<*>, inward: Boolean = true): DataFrame = + pivotMatches(inward) { columns.toColumnSet() } + +// endregion + +// region pivotCounts + +public fun AggregateGroupedDsl.pivotCounts( + inward: Boolean = true, + columns: ColumnsSelector, +): DataFrame = pivot(inward, columns).matches() + +public fun AggregateGroupedDsl.pivotCounts(vararg columns: String, inward: Boolean = true): DataFrame = + pivotCounts(inward) { columns.toColumnSet() } + +public fun AggregateGroupedDsl.pivotCounts( + vararg columns: AnyColumnReference, + inward: Boolean = true, +): DataFrame = pivotCounts(inward) { columns.toColumnSet() } + +public fun AggregateGroupedDsl.pivotCounts(vararg columns: KProperty<*>, inward: Boolean = true): DataFrame = + pivotCounts(inward) { columns.toColumnSet() } + +// endregion + +// endregion + +public interface Pivot : Aggregatable + +public typealias PivotColumnsSelector = Selector, ColumnsResolver> + +public class ReducedPivot( + @PublishedApi internal val pivot: Pivot, + @PublishedApi internal val reducer: Selector, DataRow?>, +) { + override fun toString(): String = "ReducedPivot(pivot=$pivot, reducer=$reducer)" +} + +internal fun Pivot.reduce(reducer: Selector, DataRow?>) = ReducedPivot(this, reducer) + +@PublishedApi +internal inline fun Pivot.delegate(crossinline body: PivotGroupBy.() -> DataFrame): DataRow = + body(groupBy { none() })[0] + +public interface PivotGroupBy : Aggregatable { + + public fun aggregate(separate: Boolean = false, body: AggregateBody): DataFrame + + public fun default(value: Any?): PivotGroupBy +} + +public class ReducedPivotGroupBy( + @PublishedApi internal val pivot: PivotGroupBy, + @PublishedApi internal val reducer: Selector, DataRow?>, +) { + override fun toString(): String = "ReducedPivotGroupBy(pivot=$pivot, reducer=$reducer)" +} + +@PublishedApi +internal fun PivotGroupBy.reduce(reducer: Selector, DataRow?>): ReducedPivotGroupBy = + ReducedPivotGroupBy(this, reducer) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/print.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/print.kt new file mode 100644 index 000000000..b515b7ba1 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/print.kt @@ -0,0 +1,46 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.io.renderToString +import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema + +// region DataColumn + +public fun DataColumn.print(): Unit = println(this) + +// endregion + +// region DataRow + +public fun DataRow.print(): Unit = println(this) + +// endregion + +// region DataFrame + +public fun DataFrame.print( + rowsLimit: Int = 20, + valueLimit: Int = 40, + borders: Boolean = false, + alignLeft: Boolean = false, + columnTypes: Boolean = false, + title: Boolean = false, +): Unit = println(renderToString(rowsLimit, valueLimit, borders, alignLeft, columnTypes, title)) + +// endregion + +// region GroupBy + +public fun GroupBy.print(): Unit = println(this) + +// endregion + +// region DataFrameSchema + +public fun DataFrameSchema.print(): Unit = println(this) + +// endregion + +public fun CodeString.print(): Unit = println(this) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/remove.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/remove.kt new file mode 100644 index 000000000..39ef71fa4 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/remove.kt @@ -0,0 +1,41 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.removeImpl +import kotlin.reflect.KProperty + +// region DataFrame + +// region remove + +@Refine +@Interpretable("Remove0") +public fun DataFrame.remove(columns: ColumnsSelector): DataFrame = + removeImpl(allowMissingColumns = true, columns = columns).df + +public fun DataFrame.remove(vararg columns: String): DataFrame = remove { columns.toColumnSet() } + +public fun DataFrame.remove(vararg columns: AnyColumnReference): DataFrame = remove { columns.toColumnSet() } + +public fun DataFrame.remove(vararg columns: KProperty<*>): DataFrame = remove { columns.toColumnSet() } + +// endregion + +// region minus + +public infix operator fun DataFrame.minus(columns: ColumnsSelector): DataFrame = remove(columns) + +public infix operator fun DataFrame.minus(column: String): DataFrame = remove(column) + +public infix operator fun DataFrame.minus(column: AnyColumnReference): DataFrame = remove(column) + +public infix operator fun DataFrame.minus(columns: KProperty<*>): DataFrame = remove(columns) + +// endregion + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/rename.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/rename.kt new file mode 100644 index 000000000..851a0d4d0 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/rename.kt @@ -0,0 +1,743 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.annotations.HasSchema +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.renamedReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.DELIMITED_STRING_REGEX +import org.jetbrains.kotlinx.dataframe.impl.DELIMITERS_REGEX +import org.jetbrains.kotlinx.dataframe.impl.api.renameImpl +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.toCamelCaseByDelimiters +import kotlin.reflect.KProperty + +// region DataFrame + +public fun DataFrame.rename(vararg mappings: Pair): DataFrame = + rename { mappings.map { it.first.toColumnAccessor() }.toColumnSet() } + .into(*mappings.map { it.second }.toTypedArray()) + +@Interpretable("Rename") +public fun DataFrame.rename(columns: ColumnsSelector): RenameClause = RenameClause(this, columns) + +public fun DataFrame.rename(vararg cols: ColumnReference): RenameClause = + rename { cols.toColumnSet() } + +public fun DataFrame.rename(vararg cols: KProperty): RenameClause = rename { cols.toColumnSet() } + +public fun DataFrame.rename(vararg cols: String): RenameClause = rename { cols.toColumnSet() } + +@HasSchema(schemaArg = 0) +public class RenameClause(internal val df: DataFrame, internal val columns: ColumnsSelector) { + override fun toString(): String = "RenameClause(df=$df, columns=$columns)" +} + +/** + * ## Rename to camelCase + * + * This function renames all columns to `camelCase` by replacing all [delimiters][DELIMITERS_REGEX] + * and converting the first char to lowercase. + * Even [DataFrames][DataFrame] inside [FrameColumns][FrameColumn] are traversed recursively. + */ +public fun DataFrame.renameToCamelCase(): DataFrame = + // recursively rename all columns written with delimiters or starting with a capital to camel case + rename { + colsAtAnyDepth { it.name() matches DELIMITED_STRING_REGEX || it.name[0].isUpperCase() } + }.toCamelCase() + // take all frame columns at any depth and call renameToCamelCase() on all dataframes inside + .update { + colsAtAnyDepth().colsOf() + }.with { it.renameToCamelCase() } + +public fun RenameClause.into(vararg newColumns: ColumnReference<*>): DataFrame = + into(*newColumns.map { it.name() }.toTypedArray()) + +@Refine +@Interpretable("RenameInto") +public fun RenameClause.into(vararg newNames: String): DataFrame = renameImpl(newNames) + +public fun RenameClause.into(vararg newNames: KProperty<*>): DataFrame = + into(*newNames.map { it.name }.toTypedArray()) + +public fun RenameClause.into(transform: (ColumnWithPath) -> String): DataFrame = + renameImpl(transform) + +/** + * ## Rename to camelCase + * + * Renames the selected columns to `camelCase` by replacing all [delimiters][DELIMITERS_REGEX] + * and converting the first char to lowercase. + */ +public fun RenameClause.toCamelCase(): DataFrame = + into { + it.name() + .toCamelCaseByDelimiters(DELIMITERS_REGEX) + .replaceFirstChar { it.lowercaseChar() } + } + +// endregion + +// region DataColumn + +@Suppress("UNCHECKED_CAST") +public fun > C.rename(column: KProperty): C = rename(column.columnName) as C + +@Suppress("UNCHECKED_CAST") +public fun > C.rename(column: ColumnAccessor): C = rename(column.name()) as C + +// endregion + +// region named + +@Suppress("UNCHECKED_CAST") +public infix fun > C.named(name: String): C = rename(name) as C + +public infix fun > C.named(name: KProperty<*>): C = rename(name) + +public infix fun > C.named(name: ColumnAccessor<*>): C = rename(name) + +// endregion + +// region ColumnsSelectionDsl + +/** + * ## Rename: `named` / `into` [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface RenameColumnsSelectionDsl { + + /** + * ## Rename: `named` / `into` Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `column: `[`ColumnAccessor`][org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor]` | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<*> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]` `[**named**][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.named]`/`[**into**][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.into]` `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef] + * + * `| `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]__`.`__[**named**][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.named]**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`)`** + * + * `| `[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]__`.`__[**into**][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.into]**`(`**[`column`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnDef]**`)`** + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**named**][ColumnsSelectionDsl.named] */ + public interface InfixNamedName + + /** [**into**][ColumnsSelectionDsl.into] */ + public interface InfixIntoName + + /** __`.`__[**named**][ColumnsSelectionDsl.named] */ + public interface NamedName + + /** __`.`__[**into**][ColumnsSelectionDsl.into] */ + public interface IntoName + } + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][ColumnReference.named] or [into][ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar] + * + * #### For Example: + * + * `df.`[select][DataFrame.select]` { name `[named][ColumnReference.named]` "Full Name" }` + * + * `df.`[select][DataFrame.select]` { `[expr][expr]` { 0 } `[into][ColumnReference.into]` "zeroes" }` + * + * `df.`[select][DataFrame.select]` { "colA" `[named][String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][DataFrame.select]` { `[][.]` }` + * + * @receiver The [] referencing the column to rename. + * @param [] A [] used to specify the new name of the column. + * @return A [ColumnReference] to the renamed column. + */ + private interface CommonRenameDocs { + + interface ReceiverArg + + interface ReceiverTypeArg + + /** "named" or "into" */ + interface FunctionNameArg + + /** "newName" or "nameOf" */ + interface ParamNameArg + + interface ParamArg + + interface ParamTypeArg + + /** + */ + interface ColumnReferenceReceiver + + /** + */ + interface StringReceiver + + /** + */ + interface KPropertyReceiver + + /** + */ + interface ColumnReferenceParam + + /** + */ + interface StringParam + + /** + */ + interface KPropertyParam + + interface NamedFunctionName + + interface IntoFunctionName + } + + // region named + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { columnA `[named][ColumnReference.named]` "columnB" }` + * + * @receiver The [ColumnReference] referencing the column to rename. + * @param [newName] A [String] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun ColumnReference.named(newName: String): ColumnReference = renamedReference(newName) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { columnA `[named][ColumnReference.named]` columnB }` + * + * @receiver The [ColumnReference] referencing the column to rename. + * @param [nameOf] A [ColumnReference] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun ColumnReference.named(nameOf: ColumnReference<*>): ColumnReference = named(nameOf.name) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { columnA `[named][ColumnReference.named]` Type::columnB }` + * + * @receiver The [ColumnReference] referencing the column to rename. + * @param [nameOf] A [KProperty] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun ColumnReference.named(nameOf: KProperty<*>): ColumnReference = named(nameOf.columnName) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnA" `[named][String.named]` "columnB" }` + * + * @receiver The [String] referencing the column to rename. + * @param [newName] A [String] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun String.named(newName: String): ColumnReference<*> = toColumnAccessor().named(newName) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnA" `[named][String.named]` columnB }` + * + * @receiver The [String] referencing the column to rename. + * @param [nameOf] A [ColumnReference] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun String.named(nameOf: ColumnReference<*>): ColumnReference<*> = + toColumnAccessor().named(nameOf.name) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnA" `[named][String.named]` Type::columnB }` + * + * @receiver The [String] referencing the column to rename. + * @param [nameOf] A [KProperty] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun String.named(nameOf: KProperty<*>): ColumnReference<*> = + toColumnAccessor().named(nameOf.columnName) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnA `[named][KProperty.named]` "columnB" }` + * + * @receiver The [KProperty] referencing the column to rename. + * @param [newName] A [String] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun KProperty.named(newName: String): ColumnReference = toColumnAccessor().named(newName) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnA `[named][KProperty.named]` columnB }` + * + * @receiver The [KProperty] referencing the column to rename. + * @param [nameOf] A [ColumnReference] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun KProperty.named(nameOf: ColumnReference<*>): ColumnReference = + toColumnAccessor().named(nameOf.name) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnA `[named][KProperty.named]` Type::columnB }` + * + * @receiver The [KProperty] referencing the column to rename. + * @param [nameOf] A [KProperty] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun KProperty.named(nameOf: KProperty<*>): ColumnReference = + toColumnAccessor().named(nameOf.columnName) + + // endregion + + // region into + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { columnA `[into][ColumnReference.into]` "columnB" }` + * + * @receiver The [ColumnReference] referencing the column to rename. + * @param [newName] A [String] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun ColumnReference.into(newName: String): ColumnReference = named(newName) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { columnA `[into][ColumnReference.into]` columnB }` + * + * @receiver The [ColumnReference] referencing the column to rename. + * @param [nameOf] A [ColumnReference] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun ColumnReference.into(nameOf: ColumnReference<*>): ColumnReference = named(nameOf) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { columnA `[into][ColumnReference.into]` Type::columnB }` + * + * @receiver The [ColumnReference] referencing the column to rename. + * @param [nameOf] A [KProperty] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun ColumnReference.into(nameOf: KProperty<*>): ColumnReference = named(nameOf) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnA" `[into][String.into]` "columnB" }` + * + * @receiver The [String] referencing the column to rename. + * @param [newName] A [String] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun String.into(newName: String): ColumnReference<*> = named(newName) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnA" `[into][String.into]` columnB }` + * + * @receiver The [String] referencing the column to rename. + * @param [nameOf] A [ColumnReference] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun String.into(nameOf: ColumnReference<*>): ColumnReference<*> = named(nameOf) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "columnA" `[into][String.into]` Type::columnB }` + * + * @receiver The [String] referencing the column to rename. + * @param [nameOf] A [KProperty] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun String.into(nameOf: KProperty<*>): ColumnReference<*> = named(nameOf) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnA `[into][KProperty.into]` "columnB" }` + * + * @receiver The [KProperty] referencing the column to rename. + * @param [newName] A [String] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun KProperty.into(newName: String): ColumnReference = named(newName) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnA `[into][KProperty.into]` columnB }` + * + * @receiver The [KProperty] referencing the column to rename. + * @param [nameOf] A [ColumnReference] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun KProperty.into(nameOf: ColumnReference<*>): ColumnReference = named(nameOf) + + /** + * ## Rename: `named` / `into` + * Renaming a column in the [ColumnsSelectionDsl][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] is done by calling the `infix` functions + * [named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named] or [into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]. They behave exactly the same, + * so it's up to contextual preference which one to use. Any combination of [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi] can be + * used to specify the column to rename and which name should be used instead. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.RenameColumnsSelectionDsl.Grammar] + * + * #### For Example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { name `[named][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.named]` "Full Name" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[expr][org.jetbrains.kotlinx.dataframe.api.expr]` { 0 } `[into][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.into]` "zeroes" }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "colA" `[named][kotlin.String.named]` Type::colB }` + * + * #### Example for this overload: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { Type::columnA `[into][KProperty.into]` Type::columnB }` + * + * @receiver The [KProperty] referencing the column to rename. + * @param [nameOf] A [KProperty] used to specify the new name of the column. + * @return A [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] to the renamed column. + */ + public infix fun KProperty.into(nameOf: KProperty<*>): ColumnReference = named(nameOf) + + // endregion +} + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/reorder.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/reorder.kt new file mode 100644 index 000000000..16ff44e00 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/reorder.kt @@ -0,0 +1,55 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.ColumnExpression +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.Selector +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.reorderImpl +import kotlin.reflect.KProperty + +// region DataFrame + +public data class Reorder( + internal val df: DataFrame, + internal val columns: ColumnsSelector, + internal val inFrameColumns: Boolean, +) { + public fun cast(): Reorder = this as Reorder +} + +public fun DataFrame.reorder(selector: ColumnsSelector): Reorder = Reorder(this, selector, false) + +public fun DataFrame.reorder(vararg columns: ColumnReference): Reorder = + reorder { columns.toColumnSet() } + +public fun DataFrame.reorder(vararg columns: KProperty): Reorder = reorder { columns.toColumnSet() } + +public fun DataFrame.reorder(vararg columns: String): Reorder = reorder { columns.toColumnSet() } + +public fun > Reorder.by(expression: ColumnExpression): DataFrame = + reorderImpl(false, expression) + +public fun Reorder.byName(desc: Boolean = false): DataFrame = + if (desc) byDesc { it.name } else by { it.name } + +public fun > Reorder.byDesc(expression: ColumnExpression): DataFrame = + reorderImpl(true, expression) + +public fun > DataFrame.reorderColumnsBy( + atAnyDepth: Boolean = true, + desc: Boolean = false, + expression: Selector, +): DataFrame = + Reorder( + df = this, + columns = { if (atAnyDepth) colsAtAnyDepth() else all() }, + inFrameColumns = atAnyDepth, + ).reorderImpl(desc, expression) + +public fun DataFrame.reorderColumnsByName(atAnyDepth: Boolean = true, desc: Boolean = false): DataFrame = + reorderColumnsBy(atAnyDepth, desc) { name() } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/replace.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/replace.kt new file mode 100644 index 000000000..251c359c4 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/replace.kt @@ -0,0 +1,61 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyBaseCol +import org.jetbrains.kotlinx.dataframe.AnyCol +import org.jetbrains.kotlinx.dataframe.ColumnsContainer +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.get +import org.jetbrains.kotlinx.dataframe.impl.api.ColumnToInsert +import org.jetbrains.kotlinx.dataframe.impl.api.insertImpl +import org.jetbrains.kotlinx.dataframe.impl.api.removeImpl +import kotlin.reflect.KProperty + +public fun DataFrame.replace(columns: ColumnsSelector): ReplaceClause = + ReplaceClause(this, columns) + +public fun DataFrame.replace(vararg columns: String): ReplaceClause = replace { columns.toColumnSet() } + +public fun DataFrame.replace(vararg columns: ColumnReference): ReplaceClause = + replace { columns.toColumnSet() } + +public fun DataFrame.replace(vararg columns: KProperty): ReplaceClause = + replace { columns.toColumnSet() } + +public fun DataFrame.replaceAll( + vararg valuePairs: Pair, + columns: ColumnsSelector = { colsAtAnyDepth { !it.isColumnGroup() } }, +): DataFrame { + val map = valuePairs.toMap() + return update(columns).with { map[it] ?: it } +} + +public class ReplaceClause(internal val df: DataFrame, internal val columns: ColumnsSelector) { + override fun toString(): String = "ReplaceClause(df=$df, columns=$columns)" +} + +public fun ReplaceClause.with(vararg columns: AnyCol): DataFrame = with(columns.toList()) + +public fun ReplaceClause.with(newColumns: List): DataFrame { + var index = 0 + return with { + require(index < newColumns.size) { + "Insufficient number of new columns in 'replace': ${newColumns.size} instead of ${df[columns].size}" + } + newColumns[index++] + } +} + +// TODO: Issue #418: breaks if running on ColumnGroup and its child +public fun ReplaceClause.with(transform: ColumnsContainer.(DataColumn) -> AnyBaseCol): DataFrame { + val removeResult = df.removeImpl(columns = columns) + val toInsert = removeResult.removedColumns.map { + @Suppress("UNCHECKED_CAST") + val newCol = transform(df, it.data.column as DataColumn) + ColumnToInsert(it.pathFromRoot().dropLast(1) + newCol.name, newCol, it) + } + return removeResult.df.insertImpl(toInsert) +} diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/reverse.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/reverse.kt new file mode 100644 index 000000000..3e3f66325 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/reverse.kt @@ -0,0 +1,18 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.ValueColumn +import org.jetbrains.kotlinx.dataframe.indices + +public fun DataFrame.reverse(): DataFrame = get(indices.reversed()) + +public fun DataColumn.reverse(): DataColumn = get(indices.reversed()) + +public fun ColumnGroup.reverse(): ColumnGroup = get(indices.reversed()) + +public fun FrameColumn.reverse(): FrameColumn = get(indices.reversed()) + +public fun ValueColumn.reverse(): ValueColumn = get(indices.reversed()) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/schema.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/schema.kt new file mode 100644 index 000000000..de2eef841 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/schema.kt @@ -0,0 +1,30 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.AnyRow +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.impl.owner +import org.jetbrains.kotlinx.dataframe.impl.schema.extractSchema +import org.jetbrains.kotlinx.dataframe.impl.schema.getSchema +import org.jetbrains.kotlinx.dataframe.schema.DataFrameSchema + +// region DataRow + +public fun AnyRow.schema(): DataFrameSchema = owner.schema() + +// endregion + +// region DataFrame + +public fun AnyFrame.schema(): DataFrameSchema = extractSchema() + +// endregion + +// region GroupBy + +public fun GroupBy<*, *>.schema(): DataFrameSchema = toDataFrame().schema() + +// endregion + +@Suppress("UnusedReceiverParameter") +public inline fun DataFrame.compileTimeSchema(): DataFrameSchema = getSchema(T::class) diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/select.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/select.kt new file mode 100644 index 000000000..7f2985d2d --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/select.kt @@ -0,0 +1,523 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.AnyColumnReference +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.annotations.Interpretable +import org.jetbrains.kotlinx.dataframe.annotations.Refine +import org.jetbrains.kotlinx.dataframe.api.Select.SelectSelectingOptions +import org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.changePath +import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnSet +import kotlin.reflect.KProperty + +// region DataFrame + +/** + * ## The Select Operation + * + * Returns a new [DataFrame] with only the columns selected by [columns]. + * + * See [Selecting Columns][SelectSelectingOptions]. + * + * For more information: [See `select` on the documentation website.](https://kotlin.github.io/dataframe/select.html) + */ +internal interface Select { + + /** + * + * ## Selecting Columns + * Selecting columns for various operations (including but not limited to + * [DataFrame.select][org.jetbrains.kotlinx.dataframe.DataFrame.select], [DataFrame.update][org.jetbrains.kotlinx.dataframe.DataFrame.update], [DataFrame.gather][org.jetbrains.kotlinx.dataframe.DataFrame.gather], and [DataFrame.fillNulls][org.jetbrains.kotlinx.dataframe.DataFrame.fillNulls]) + * can be done in the following ways: + * ### 1. [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.Dsl.WithExample] + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * #### NOTE: There's also a 'single column' variant used sometimes: [Column Selection DSL][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.DslSingle.WithExample]. + * ### 2. [Column names][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnNames.WithExample] + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]`("length", "age")` + * + * ### 3. [Column references][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.ColumnAccessors.WithExample] + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]`(length, age)` + * + * ### 4. [KProperties][org.jetbrains.kotlinx.dataframe.documentation.SelectingColumns.KProperties.WithExample] + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]`(Person::length, Person::age)` + * + */ + interface SelectSelectingOptions +} + +/** + * ## The Select Operation + * + * Returns a new [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with only the columns selected by [columns][org.jetbrains.kotlinx.dataframe.columns]. + * + * See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Select.SelectSelectingOptions]. + * + * For more information: [See `select` on the documentation website.](https://kotlin.github.io/dataframe/select.html) + * ### This Select Overload + * Select or express columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]. + * (Any (combination of) [Access API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi]). + * + * This DSL is initiated by a [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda, + * which operates in the context of the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] and + * expects you to return a [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] or [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] (so, a [ColumnsResolver][org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver]). + * This is an entity formed by calling any (combination) of the functions + * in the DSL that is or can be resolved into one or more columns. + * + * #### NOTE: + * While you can use the [String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi] and [KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi] + * in this DSL directly with any function, they are NOT valid return types for the + * [Columns Selector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] lambda. You'd need to turn them into a [ColumnReference][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] first, for instance + * with a function like [`col("name")`][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.col]. + * + * ### Check out: [Columns Selection DSL Grammar][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.DslGrammar] + * + *      + * + * [See Column Selectors on the documentation website.](https://kotlin.github.io/dataframe/columnselectors.html) + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]` { length `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` age }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]` { `[cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols]`(1..5) }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]` { `[colsOf][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.colsOf]`<`[Double][Double]`>() }` + * + * + * @param [columns] The [Columns Selector][ColumnsSelector] used to select the columns of this [DataFrame]. + */ +@Refine +@Interpretable("Select0") +public fun DataFrame.select(columns: ColumnsSelector): DataFrame = get(columns).toDataFrame().cast() + +/** + * ## The Select Operation + * + * Returns a new [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with only the columns selected by [columns][org.jetbrains.kotlinx.dataframe.columns]. + * + * See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Select.SelectSelectingOptions]. + * + * For more information: [See `select` on the documentation website.](https://kotlin.github.io/dataframe/select.html) + * ### This Select Overload + * Select columns using [KProperties][KProperty] ([KProperties API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.KPropertiesApi]). + * + * #### For example: + * ```kotlin + * data class Person(val length: Double, val age: Double) + * ``` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]`(Person::length, Person::age)` + * + * @param [columns] The [KProperties][KProperty] used to select the columns of this [DataFrame]. + */ +public fun DataFrame.select(vararg columns: KProperty<*>): DataFrame = select { columns.toColumnSet() } + +/** + * ## The Select Operation + * + * Returns a new [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with only the columns selected by [columns][org.jetbrains.kotlinx.dataframe.columns]. + * + * See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Select.SelectSelectingOptions]. + * + * For more information: [See `select` on the documentation website.](https://kotlin.github.io/dataframe/select.html) + * ### This Select Overload + * Select columns using their [column names][String] + * ([String API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.StringApi]). + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]`("length", "age")` + * + * @param [columns] The [Column Names][String] used to select the columns of this [DataFrame]. + */ +public fun DataFrame.select(vararg columns: String): DataFrame = select { columns.toColumnSet() } + +/** + * ## The Select Operation + * + * Returns a new [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame] with only the columns selected by [columns][org.jetbrains.kotlinx.dataframe.columns]. + * + * See [Selecting Columns][org.jetbrains.kotlinx.dataframe.api.Select.SelectSelectingOptions]. + * + * For more information: [See `select` on the documentation website.](https://kotlin.github.io/dataframe/select.html) + * ### This Select Overload + * Select columns using [column accessors][org.jetbrains.kotlinx.dataframe.columns.ColumnReference] + * ([Column Accessors API][org.jetbrains.kotlinx.dataframe.documentation.AccessApi.ColumnAccessorsApi]). + * + * #### For example: + * + * `val length by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `val age by `[column][org.jetbrains.kotlinx.dataframe.api.column]`<`[Double][Double]`>()` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.api.select]`(length, age)` + * + * @param [columns] The [Column Accessors][ColumnReference] used to select the columns of this [DataFrame]. + */ +public fun DataFrame.select(vararg columns: AnyColumnReference): DataFrame = select { columns.toColumnSet() } + +// endregion + +// region ColumnsSelectionDsl +// NOTE: invoke overloads are inside ColumnsSelectionDsl.kt due to conflicts + +/** + * ## Select [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface SelectColumnsSelectionDsl { + + /** + * ## Select from [ColumnGroup] Grammar + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `colsSelector: `[`ColumnsSelector`][org.jetbrains.kotlinx.dataframe.ColumnsSelector] + * + * + * + * + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`select`**][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.select]**` { `**[`colsSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsSelectorDef]**` }`** + * + *     `| `[**`{`**][ColumnsSelectionDsl.select]` `[`colsSelector`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnsSelectorDef]` `[**`}`**][ColumnsSelectionDsl.select] + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** __`.`__[**`select`**][ColumnsSelectionDsl.select] */ + public interface ColumnGroupName + } + + /** + * ## Select from [ColumnGroup] + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on + * any [ColumnGroup]. This is more powerful than the [cols][ColumnsSelectionDsl.cols] filter, because now all + * operations of the DSL are at your disposal. + * + * The scope of the new DSL instance is relative to + * the [ColumnGroup] you are selecting from. + * + * The [invoke][ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method. + * + * ### Check out: [Grammar] + * + * #### For example: + * + * `df.`[select][DataFrame.select]` { myColGroup.`[select][SingleColumn.select]` { someCol `[and][ColumnsSelectionDsl.and]` `[colsOf][SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { "myGroupCol" `[{][String.select]` "colA" and `[expr][ColumnsSelectionDsl.expr]` { 0 } `[}][String.select]` }` + * + * `df.`[select][DataFrame.select]` { "pathTo"["myGroupCol"].`[select][ColumnPath.select]` { "colA" and "colB" } }` + * + * `df.`[select][DataFrame.select]` { it["myGroupCol"].`[asColumnGroup][DataColumn.asColumnGroup]`()`[() {][SingleColumn.select]` "colA" and "colB" `[}][SingleColumn.select]` }` + * + * #### Examples for this overload: + * + * + * + * + *      + * + * + * See also [except][ColumnsSelectionDsl.except]/[allExcept][ColumnsSelectionDsl.allColsExcept] for the inverted operation of this function. + * + * @param [selector] The [ColumnsSelector] to use for the selection. + * @receiver The [ColumnGroup] to select from. + * @throws [IllegalArgumentException] If [this] is not a [ColumnGroup]. + * @return A [ColumnSet] containing the columns selected by [selector]. + * @see [SingleColumn.except] + */ + private interface CommonSelectDocs { + + interface ExampleArg + } + + /** + * ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on + * any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all + * operations of the DSL are at your disposal. + * + * The scope of the new DSL instance is relative to + * the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from. + * + * The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` { someCol `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol" `[{][kotlin.String.select]` "colA" and `[expr][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]` { 0 } `[}][kotlin.String.select]` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[select][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.select]` { "colA" and "colB" } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { it["myGroupCol"].`[asColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.asColumnGroup]`()`[() {][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` "colA" and "colB" `[}][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColGroup.`[select][SingleColumn.select]` { someCol `[and][ColumnsSelectionDsl.and]` `[colsOf][SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { myColGroup `[`{`][SingleColumn.select]` colA `[and][ColumnsSelectionDsl.and]` colB `[`}`][SingleColumn.select]` }` + * + * + *      + * + * + * See also [except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]/[allExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] for the inverted operation of this function. + * + * @param [selector] The [ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] to use for the selection. + * @receiver The [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] to select from. + * @throws [IllegalArgumentException] If [this] is not a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector]. + * @see [SingleColumn.except] + */ + public fun SingleColumn>.select(selector: ColumnsSelector): ColumnSet = + selectInternal(selector) + + /** + * ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on + * any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all + * operations of the DSL are at your disposal. + * + * The scope of the new DSL instance is relative to + * the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from. + * + * The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` { someCol `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol" `[{][kotlin.String.select]` "colA" and `[expr][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]` { 0 } `[}][kotlin.String.select]` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[select][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.select]` { "colA" and "colB" } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { it["myGroupCol"].`[asColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.asColumnGroup]`()`[() {][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` "colA" and "colB" `[}][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColGroup.`[select][KProperty.select]` { someCol `[and][ColumnsSelectionDsl.and]` `[colsOf][SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColGroup `[`{`][KProperty.select]` colA `[and][ColumnsSelectionDsl.and]` colB `[`}`][KProperty.select]` }` + * + * + *      + * + * + * See also [except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]/[allExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] for the inverted operation of this function. + * + * @param [selector] The [ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] to use for the selection. + * @receiver The [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] to select from. + * @throws [IllegalArgumentException] If [this] is not a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector]. + * @see [SingleColumn.except] + */ + public fun KProperty.select(selector: ColumnsSelector): ColumnSet = + columnGroup(this).select(selector) + + /** + * ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on + * any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all + * operations of the DSL are at your disposal. + * + * The scope of the new DSL instance is relative to + * the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from. + * + * The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` { someCol `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol" `[{][kotlin.String.select]` "colA" and `[expr][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]` { 0 } `[}][kotlin.String.select]` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[select][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.select]` { "colA" and "colB" } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { it["myGroupCol"].`[asColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.asColumnGroup]`()`[() {][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` "colA" and "colB" `[}][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColGroup".`[select][String.select]` { someCol `[and][ColumnsSelectionDsl.and]` `[colsOf][SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { "myColGroup" `[`{`][String.select]` colA `[and][ColumnsSelectionDsl.and]` colB `[`}`][String.select]` }` + * + * + *      + * + * + * See also [except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]/[allExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] for the inverted operation of this function. + * + * @param [selector] The [ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] to use for the selection. + * @receiver The [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] to select from. + * @throws [IllegalArgumentException] If [this] is not a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector]. + * @see [SingleColumn.except] + */ + public fun String.select(selector: ColumnsSelector<*, R>): ColumnSet = columnGroup(this).select(selector) + + /** + * ## Select from [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] + * + * Perform a selection of columns using the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] on + * any [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. This is more powerful than the [cols][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.cols] filter, because now all + * operations of the DSL are at your disposal. + * + * The scope of the new DSL instance is relative to + * the [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] you are selecting from. + * + * The [invoke][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.invoke] operator is overloaded to work as a shortcut for this method. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SelectColumnsSelectionDsl.Grammar] + * + * #### For example: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { myColGroup.`[select][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` { someCol `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[colsOf][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myGroupCol" `[{][kotlin.String.select]` "colA" and `[expr][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.expr]` { 0 } `[}][kotlin.String.select]` }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "pathTo"["myGroupCol"].`[select][org.jetbrains.kotlinx.dataframe.columns.ColumnPath.select]` { "colA" and "colB" } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { it["myGroupCol"].`[asColumnGroup][org.jetbrains.kotlinx.dataframe.DataColumn.asColumnGroup]`()`[() {][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` "colA" and "colB" `[}][org.jetbrains.kotlinx.dataframe.columns.SingleColumn.select]` }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColGroup"].`[select][ColumnPath.select]` { someCol `[and][ColumnsSelectionDsl.and]` `[colsOf][SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColGroup"] `[`{`][ColumnPath.select]` colA `[and][ColumnsSelectionDsl.and]` colB `[`}`][ColumnPath.select]` }` + * + * `df.`[select][DataFrame.select]` { `[pathOf][pathOf]`("pathTo", "myColGroup").`[select][ColumnPath.select]` { someCol `[and][ColumnsSelectionDsl.and]` `[colsOf][SingleColumn.colsOf]`<`[String][String]`>() } }` + * + * `df.`[select][DataFrame.select]` { `[pathOf][pathOf]`("pathTo", "myColGroup")`[`() {`][ColumnPath.select]` someCol `[and][ColumnsSelectionDsl.and]` `[colsOf][SingleColumn.colsOf]`<`[String][String]`>() `[`}`][ColumnPath.select]` }` + * + * + *      + * + * + * See also [except][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.except]/[allExcept][org.jetbrains.kotlinx.dataframe.api.AllExceptColumnsSelectionDsl.allColsExcept] for the inverted operation of this function. + * + * @param [selector] The [ColumnsSelector][org.jetbrains.kotlinx.dataframe.ColumnsSelector] to use for the selection. + * @receiver The [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] to select from. + * @throws [IllegalArgumentException] If [this] is not a [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup]. + * @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector]. + * @see [SingleColumn.except] + */ + public fun ColumnPath.select(selector: ColumnsSelector<*, R>): ColumnSet = columnGroup(this).select(selector) +} + +internal fun SingleColumn>.selectInternal(selector: ColumnsSelector): ColumnSet = + createColumnSet { context -> + this.ensureIsColumnGroup().resolveSingle(context)?.let { col -> + require(col.isColumnGroup()) { + "Column ${col.path} is not a ColumnGroup and can thus not be selected from." + } + + col.getColumnsWithPaths(selector as ColumnsSelector<*, R>) + .map { it.changePath(col.path + it.path) } + } ?: emptyList() + } +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/shuffle.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/shuffle.kt new file mode 100644 index 000000000..dc4f79187 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/shuffle.kt @@ -0,0 +1,22 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.indices +import kotlin.random.Random + +// region DataColumn + +public fun DataColumn.shuffle(random: Random): DataColumn = get(indices.shuffled(random)) + +public fun DataColumn.shuffle(): DataColumn = get(indices.shuffled()) + +// endregion + +// region DataFrame + +public fun DataFrame.shuffle(random: Random): DataFrame = getRows(indices.shuffled(random)) + +public fun DataFrame.shuffle(): DataFrame = getRows(indices.shuffled()) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/simplify.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/simplify.kt new file mode 100644 index 000000000..0ec33cdb2 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/simplify.kt @@ -0,0 +1,98 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.impl.columns.simplify +import org.jetbrains.kotlinx.dataframe.impl.columns.transform + +// region ColumnsSelectionDsl + +/** + * ## Simplify [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface SimplifyColumnsSelectionDsl { + + /** + * ## Simplify [ColumnSet] Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + * + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`simplify`**][org.jetbrains.kotlinx.dataframe.api.SimplifyColumnsSelectionDsl.simplify]**`()`** + * + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** __`.`__[**`simplify`**][ColumnsSelectionDsl.simplify] */ + public interface ColumnSetName + } + + /** + * ## Simplify [ColumnSet] + * + * Given a [this] [ColumnSet], [simplify] simplifies the structure by removing columns that are already present in + * column groups, returning only these groups plus columns not belonging in any of the groups. + * + * In other words, this means that if a column in [this] is inside another column group in [this], + * it will not be included in the result. + * + * ### Check out: [Grammar] + * + * ## For example: + * + * [cols][ColumnsSelectionDsl.cols]`(a, a.b, d.c).`[simplify][SimplifyColumnsSelectionDsl.simplify]`() == `[cols][ColumnsSelectionDsl.cols]`(a, d.c)` + * + *      + * + * `df.`[select][DataFrame.select]` { `[colsAtAnyDepth][ColumnsSelectionDsl.colsAtAnyDepth]` { "e" `[in][String.contains]` it.`[name][DataColumn.name]` }.`[simplify][ColumnSet.simplify]`() }` + * + * @return A [ColumnSet][ColumnSet]`<`[C][C]`>` containing only the columns that are not inside any column group in [this]. + */ + @Suppress("UNCHECKED_CAST") + public fun ColumnSet.simplify(): ColumnSet = simplifyInternal() as ColumnSet +} + +/** + * Simplifies structure by removing columns that are already present in + * column groups in [this]. + * + * A.k.a. it gets a sub-list of columns that are roots of the trees of columns. + */ +internal fun ColumnsResolver<*>.simplifyInternal(): ColumnSet<*> = allColumnsInternal().transform { it.simplify() } + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/single.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/single.kt new file mode 100644 index 000000000..aceabd066 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/single.kt @@ -0,0 +1,359 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.ColumnFilter +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.RowExpression +import org.jetbrains.kotlinx.dataframe.api.SingleColumnsSelectionDsl.Grammar +import org.jetbrains.kotlinx.dataframe.columns.ColumnPath +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.asColumnSet +import org.jetbrains.kotlinx.dataframe.columns.values +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet +import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableSingleColumn +import org.jetbrains.kotlinx.dataframe.impl.columns.singleOrNullWithTransformerImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.transform +import org.jetbrains.kotlinx.dataframe.nrow +import kotlin.reflect.KProperty + +// region DataColumn + +public fun DataColumn.single(): C = values.single() + +// endregion + +// region DataFrame + +public fun DataFrame.single(): DataRow = + when (nrow) { + 0 -> throw NoSuchElementException("DataFrame has no rows. Use `singleOrNull`.") + 1 -> get(0) + else -> throw IllegalArgumentException("DataFrame has more than one row.") + } + +public fun DataFrame.singleOrNull(): DataRow? = rows().singleOrNull() + +public fun DataFrame.single(predicate: RowExpression): DataRow = + rows().single { predicate(it, it) } + +public fun DataFrame.singleOrNull(predicate: RowExpression): DataRow? = + rows().singleOrNull { predicate(it, it) } + +// endregion + +// region ColumnsSelectionDsl + +/** + * ## Single (Col) [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl] + * + * See [Grammar] for all functions in this interface. + */ +public interface SingleColumnsSelectionDsl { + + /** + * ## Single (Col) Grammar + * + * + *      + * + * [(What is this notation?)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammar] + *      + * + * ### Definitions: + * `columnSet: `[`ColumnSet`][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]`<*>` + * + *      + * + * `columnGroup: `[`SingleColumn`][org.jetbrains.kotlinx.dataframe.columns.SingleColumn]`<`[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`String`][String]` | `[`KProperty`][kotlin.reflect.KProperty]`<* | `[`DataRow`][org.jetbrains.kotlinx.dataframe.DataRow]`<*>> | `[`ColumnPath`][org.jetbrains.kotlinx.dataframe.columns.ColumnPath] + * + *      + * + * `condition: `[`ColumnFilter`][org.jetbrains.kotlinx.dataframe.ColumnFilter] + * + *      + * + * ### What can be called directly in the [Columns Selection DSL][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl]: + * + * + *      + * + * [**`single`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]: + * + * + *      + * + * [`columnSet`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnSetDef] + * + *     __`.`__[**`single`**][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + *      + * + * ### What can be called on a [Column Group (reference)][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef]: + * + * + *      + * + * [`columnGroup`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ColumnGroupDef] + * + *     __`.`__[**`singleCol`**][org.jetbrains.kotlinx.dataframe.api.SingleColumnsSelectionDsl.singleCol]` [ `**`{ `**[`condition`][org.jetbrains.kotlinx.dataframe.documentation.DslGrammarTemplateColumnsSelectionDsl.DslGrammarTemplate.ConditionDef]**` }`**` ]` + * + * + * + * + * + * + * + * + * + * + * + * + * + */ + public interface Grammar { + + /** [**`single`**][ColumnsSelectionDsl.single] */ + public interface PlainDslName + + /** __`.`__[**`single`**][ColumnsSelectionDsl.single] */ + public interface ColumnSetName + + /** __`.`__[**`singleCol`**][ColumnsSelectionDsl.singleCol] */ + public interface ColumnGroupName + } + + /** + * ## Single (Col) + * Returns the single column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * If multiple columns adhere to it, [IllegalArgumentException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][ColumnsSelectionDsl], `single` is named `singleCol` instead to avoid confusion. + * + * ### Check out: [Grammar] + * + * #### Examples: + * + * `df.`[select][DataFrame.select]` { `[single][ColumnsSelectionDsl.single]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[singleCol][String.singleCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * + * + * @param [condition] The optional [ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn] containing the single column that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @throws [IllegalArgumentException] if more than one column adheres to the given [condition]. + */ + private interface CommonSingleDocs { + + /** Examples key */ + interface Examples + } + + /** + * ## Single (Col) + * Returns the single column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * If multiple columns adhere to it, [IllegalArgumentException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl], `single` is named `singleCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SingleColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[singleCol][kotlin.String.singleCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[String][String]`>().`[single][ColumnSet.single]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * `df.`[select][DataFrame.select]` { `[colsOf][SingleColumn.colsOf]`<`[Int][Int]`>().`[single][ColumnSet.single]`() }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the single column that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @throws [IllegalArgumentException] if more than one column adheres to the given [condition]. + */ + public fun ColumnSet.single(condition: ColumnFilter = { true }): TransformableSingleColumn = + singleInternal(condition) + + /** + * ## Single (Col) + * Returns the single column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * If multiple columns adhere to it, [IllegalArgumentException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl], `single` is named `singleCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SingleColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[singleCol][kotlin.String.singleCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { `[single][ColumnsSelectionDsl.single]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the single column that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @throws [IllegalArgumentException] if more than one column adheres to the given [condition]. + */ + public fun ColumnsSelectionDsl<*>.single(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + asSingleColumn().singleCol(condition) + + /** + * ## Single (Col) + * Returns the single column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * If multiple columns adhere to it, [IllegalArgumentException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl], `single` is named `singleCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SingleColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[singleCol][kotlin.String.singleCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { myColumnGroup.`[singleCol][SingleColumn.singleCol]`() }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the single column that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @throws [IllegalArgumentException] if more than one column adheres to the given [condition]. + */ + public fun SingleColumn>.singleCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + this.ensureIsColumnGroup().asColumnSet().single(condition) + + /** + * ## Single (Col) + * Returns the single column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * If multiple columns adhere to it, [IllegalArgumentException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl], `single` is named `singleCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SingleColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[singleCol][kotlin.String.singleCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "myColumnGroup".`[singleCol][String.singleCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the single column that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @throws [IllegalArgumentException] if more than one column adheres to the given [condition]. + */ + public fun String.singleCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + columnGroup(this).singleCol(condition) + + /** + * ## Single (Col) + * Returns the single column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * If multiple columns adhere to it, [IllegalArgumentException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl], `single` is named `singleCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SingleColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[singleCol][kotlin.String.singleCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { Type::myColumnGroup.`[singleCol][SingleColumn.singleCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * `df.`[select][DataFrame.select]` { DataSchemaType::myColumnGroup.`[singleCol][KProperty.singleCol]`() }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the single column that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @throws [IllegalArgumentException] if more than one column adheres to the given [condition]. + */ + public fun KProperty<*>.singleCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + columnGroup(this).singleCol(condition) + + /** + * ## Single (Col) + * Returns the single column from [this] that adheres to the optional given [condition]. + * If no column adheres to the given [condition], [NoSuchElementException] is thrown. + * If multiple columns adhere to it, [IllegalArgumentException] is thrown. + * + * This function operates solely on columns at the top-level. + * + * NOTE: For [column groups][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl], `single` is named `singleCol` instead to avoid confusion. + * + * ### Check out: [Grammar][org.jetbrains.kotlinx.dataframe.api.SingleColumnsSelectionDsl.Grammar] + * + * #### Examples: + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { `[single][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.single]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` { "myColumnGroup".`[singleCol][kotlin.String.singleCol]` { it.`[name][org.jetbrains.kotlinx.dataframe.columns.ColumnReference.name]`().`[startsWith][String.startsWith]`("order") } }` + * + * #### Examples for this overload: + * + * `df.`[select][DataFrame.select]` { "pathTo"["myColumnGroup"].`[singleCol][ColumnPath.singleCol]` { it.`[name][ColumnReference.name]`().`[startsWith][String.startsWith]`("year") } }` + * + * @param [condition] The optional [ColumnFilter][org.jetbrains.kotlinx.dataframe.ColumnFilter] condition that the column must adhere to. + * @return A [SingleColumn][org.jetbrains.kotlinx.dataframe.columns.SingleColumn] containing the single column that adheres to the given [condition]. + * @throws [NoSuchElementException] if no column adheres to the given [condition]. + * @throws [IllegalArgumentException] if more than one column adheres to the given [condition]. + */ + public fun ColumnPath.singleCol(condition: ColumnFilter<*> = { true }): TransformableSingleColumn<*> = + columnGroup(this).singleCol(condition) +} + +@Suppress("UNCHECKED_CAST") +internal fun ColumnsResolver.singleInternal( + condition: ColumnFilter = { true }, +): TransformableSingleColumn = + (allColumnsInternal() as TransformableColumnSet) + .transform { listOf(it.single(condition)) } + .singleOrNullWithTransformerImpl() + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/sort.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/sort.kt new file mode 100644 index 000000000..c0b54beb5 --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/sort.kt @@ -0,0 +1,247 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataFrameExpression +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.Selector +import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnsResolver +import org.jetbrains.kotlinx.dataframe.columns.FrameColumn +import org.jetbrains.kotlinx.dataframe.columns.SingleColumn +import org.jetbrains.kotlinx.dataframe.columns.UnresolvedColumnsPolicy +import org.jetbrains.kotlinx.dataframe.columns.ValueColumn +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.SortFlag +import org.jetbrains.kotlinx.dataframe.impl.api.addFlag +import org.jetbrains.kotlinx.dataframe.impl.api.sortByImpl +import org.jetbrains.kotlinx.dataframe.impl.columns.newColumnWithActualType +import org.jetbrains.kotlinx.dataframe.impl.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.index +import org.jetbrains.kotlinx.dataframe.nrow +import org.jetbrains.kotlinx.dataframe.type +import kotlin.reflect.KProperty + +public interface SortDsl : ColumnsSelectionDsl { + public fun ColumnSet.desc(): ColumnSet = addFlag(SortFlag.Reversed) + + public fun SingleColumn.desc(): SingleColumn = addFlag(SortFlag.Reversed).single() + + public fun String.desc(): SingleColumn?> = invoke>().desc() + + public fun KProperty.desc(): SingleColumn = toColumnAccessor().desc() + + public fun ColumnSet.nullsLast(flag: Boolean = true): ColumnSet = + if (flag) addFlag(SortFlag.NullsLast) else this + + public fun SingleColumn.nullsLast(flag: Boolean = true): SingleColumn = + if (flag) addFlag(SortFlag.NullsLast).single() else this + + public fun String.nullsLast(flag: Boolean = true): SingleColumn?> = + invoke>().nullsLast(flag) + + public fun KProperty.nullsLast(flag: Boolean = true): SingleColumn = toColumnAccessor().nullsLast(flag) +} + +/** + * [SortColumnsSelector] is used to express or select multiple columns to sort by, represented by [ColumnsResolver]``, + * using the context of [SortDsl]`` as `this` and `it`. + * + * So: + * ```kotlin + * SortDsl.(it: SortDsl) -> ColumnSet + * ``` + */ +public typealias SortColumnsSelector = Selector, ColumnsResolver> + +// region DataColumn + +public fun > DataColumn.sort(): ValueColumn = + DataColumn.createValueColumn(name, values().sorted(), type, defaultValue = defaultValue()) + +public fun > DataColumn.sortDesc(): ValueColumn = + DataColumn.createValueColumn(name, values().sortedDescending(), type, defaultValue = defaultValue()) + +/** + * ## Sort [DataColumn] With + * + * This function returns the sorted version of the current [ValueColumn], [FrameColumn], or [ColumnGroup] based + * on the given [Comparator]. The [comparator] can either be given as an instance of [Comparator], or directly + * as a lambda. + * + * #### For example + * + * `df`[`[`][DataFrame.get]`"price"`[`]`][DataFrame.get]`.`[sortWith][sortWith]` { a, b -> a - b }` + * + * + *      + * + * `df.`[select][DataFrame.select]` {` + * + *     `name.`[sortWith][sortWith]`(myComparator) `[and][ColumnsSelectionDsl.and]` `[allAfter][ColumnsSelectionDsl.allAfter]`(name)` + * + * `}` + * + * @receiver The [DataColumn] to sort. This can be either a [ValueColumn], [FrameColumn], or [ColumnGroup] and will + * dictate the return type of the function. + * @param [comparator] The [Comparator] to use for sorting the [DataColumn]. This can either be a [Comparator]<[T]> or + * a lambda of type `(`[T][T]`, `[T][T]`) -> `[Int][Int]. + * @return The sorted [DataColumn] [this] of the same type as the receiver. + */ +private interface CommonDataColumnSortWithDocs + +/** ## Sort [DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn] With + * + * This function returns the sorted version of the current [ValueColumn][org.jetbrains.kotlinx.dataframe.columns.ValueColumn], [FrameColumn][org.jetbrains.kotlinx.dataframe.columns.FrameColumn], or [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] based + * on the given [Comparator]. The [comparator] can either be given as an instance of [Comparator], or directly + * as a lambda. + * + * #### For example + * + * `df`[`[`][org.jetbrains.kotlinx.dataframe.DataFrame.get]`"price"`[`]`][org.jetbrains.kotlinx.dataframe.DataFrame.get]`.`[sortWith][org.jetbrains.kotlinx.dataframe.api.sortWith]` { a, b -> a - b }` + * + * + *      + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     `name.`[sortWith][org.jetbrains.kotlinx.dataframe.api.sortWith]`(myComparator) `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[allAfter][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`(name)` + * + * `}` + * + * @receiver The [DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn] to sort. This can be either a [ValueColumn][org.jetbrains.kotlinx.dataframe.columns.ValueColumn], [FrameColumn][org.jetbrains.kotlinx.dataframe.columns.FrameColumn], or [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] and will + * dictate the return type of the function. + * @param [comparator] The [Comparator] to use for sorting the [DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]. This can either be a [Comparator]<[T]> or + * a lambda of type `(`[T][T]`, `[T][T]`) -> `[Int][Int]. + * @return The sorted [DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn] [this] of the same type as the receiver. */ +public fun > C.sortWith(comparator: Comparator): C = + DataColumn.create(name, values().sortedWith(comparator), type) as C + +/** ## Sort [DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn] With + * + * This function returns the sorted version of the current [ValueColumn][org.jetbrains.kotlinx.dataframe.columns.ValueColumn], [FrameColumn][org.jetbrains.kotlinx.dataframe.columns.FrameColumn], or [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] based + * on the given [Comparator]. The [comparator] can either be given as an instance of [Comparator], or directly + * as a lambda. + * + * #### For example + * + * `df`[`[`][org.jetbrains.kotlinx.dataframe.DataFrame.get]`"price"`[`]`][org.jetbrains.kotlinx.dataframe.DataFrame.get]`.`[sortWith][org.jetbrains.kotlinx.dataframe.api.sortWith]` { a, b -> a - b }` + * + * + *      + * + * `df.`[select][org.jetbrains.kotlinx.dataframe.DataFrame.select]` {` + * + *     `name.`[sortWith][org.jetbrains.kotlinx.dataframe.api.sortWith]`(myComparator) `[and][org.jetbrains.kotlinx.dataframe.api.AndColumnsSelectionDsl.and]` `[allAfter][org.jetbrains.kotlinx.dataframe.api.ColumnsSelectionDsl.allAfter]`(name)` + * + * `}` + * + * @receiver The [DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn] to sort. This can be either a [ValueColumn][org.jetbrains.kotlinx.dataframe.columns.ValueColumn], [FrameColumn][org.jetbrains.kotlinx.dataframe.columns.FrameColumn], or [ColumnGroup][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] and will + * dictate the return type of the function. + * @param [comparator] The [Comparator] to use for sorting the [DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn]. This can either be a [Comparator]<[T]> or + * a lambda of type `(`[T][T]`, `[T][T]`) -> `[Int][Int]. + * @return The sorted [DataColumn][org.jetbrains.kotlinx.dataframe.DataColumn] [this] of the same type as the receiver. */ +public fun > C.sortWith(comparator: (T, T) -> Int): C = sortWith(Comparator(comparator)) + +// endregion + +// region DataFrame + +public fun DataFrame.sortBy(columns: SortColumnsSelector): DataFrame = + sortByImpl(UnresolvedColumnsPolicy.Fail, columns) + +public fun DataFrame.sortBy(vararg cols: ColumnReference<*>): DataFrame = sortBy { cols.toColumnSet() } + +public fun DataFrame.sortBy(vararg cols: String): DataFrame = sortBy { cols.toColumnSet() } + +public fun DataFrame.sortBy(vararg cols: KProperty?>): DataFrame = sortBy { cols.toColumnSet() } + +public fun DataFrame.sortWith(comparator: Comparator>): DataFrame { + val permutation = rows().sortedWith(comparator).map { it.index } + return this[permutation] +} + +public fun DataFrame.sortWith(comparator: (DataRow, DataRow) -> Int): DataFrame = + sortWith(Comparator(comparator)) + +public fun DataFrame.sortByDesc(columns: SortColumnsSelector): DataFrame { + val set = columns.toColumnSet() + return sortByImpl { set.desc() } +} + +public fun DataFrame.sortByDesc(vararg columns: KProperty?>): DataFrame = + sortByDesc { columns.toColumnSet() } + +public fun DataFrame.sortByDesc(vararg columns: String): DataFrame = sortByDesc { columns.toColumnSet() } + +public fun DataFrame.sortByDesc(vararg columns: ColumnReference<*>): DataFrame = + sortByDesc { columns.toColumnSet() } + +// endregion + +// region GroupBy + +public fun GroupBy.sortBy(vararg cols: String): GroupBy = sortBy { cols.toColumnSet() } + +public fun GroupBy.sortBy(vararg cols: ColumnReference<*>): GroupBy = sortBy { cols.toColumnSet() } + +public fun GroupBy.sortBy(vararg cols: KProperty?>): GroupBy = + sortBy { cols.toColumnSet() } + +public fun GroupBy.sortBy(selector: SortColumnsSelector): GroupBy = sortByImpl(selector) + +public fun GroupBy.sortByDesc(vararg cols: String): GroupBy = sortByDesc { cols.toColumnSet() } + +public fun GroupBy.sortByDesc(vararg cols: ColumnReference<*>): GroupBy = + sortByDesc { cols.toColumnSet() } + +public fun GroupBy.sortByDesc(vararg cols: KProperty?>): GroupBy = + sortByDesc { cols.toColumnSet() } + +public fun GroupBy.sortByDesc(selector: SortColumnsSelector): GroupBy { + val set = selector.toColumnSet() + return sortByImpl { set.desc() } +} + +private fun GroupBy.createColumnFromGroupExpression( + receiver: ColumnsSelectionDsl, + expression: DataFrameExpression, +): DataColumn = + receiver.newColumnWithActualType("") { row -> + val group = row[groups] + expression(group, group) + } + +public fun GroupBy.sortByGroup( + nullsLast: Boolean = false, + expression: DataFrameExpression, +): GroupBy = + toDataFrame().sortBy { + createColumnFromGroupExpression(this, expression).nullsLast(nullsLast) + }.asGroupBy(groups) + +public fun GroupBy.sortByGroupDesc( + nullsLast: Boolean = false, + expression: DataFrameExpression, +): GroupBy = + toDataFrame().sortBy { + createColumnFromGroupExpression(this, expression).desc().nullsLast(nullsLast) + }.asGroupBy(groups) + +public fun GroupBy.sortByCountAsc(): GroupBy = sortByGroup { nrow } + +public fun GroupBy.sortByCount(): GroupBy = sortByGroupDesc { nrow } + +public fun GroupBy.sortByKeyDesc(nullsLast: Boolean = false): GroupBy = + toDataFrame() + .sortBy { keys.columns().toColumnSet().desc().nullsLast(nullsLast) } + .asGroupBy(groups) + +public fun GroupBy.sortByKey(nullsLast: Boolean = false): GroupBy = + toDataFrame() + .sortBy { keys.columns().toColumnSet().nullsLast(nullsLast) } + .asGroupBy(groups) + +// endregion diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/split.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/split.kt new file mode 100644 index 000000000..56fa8d23a --- /dev/null +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/split.kt @@ -0,0 +1,294 @@ +package org.jetbrains.kotlinx.dataframe.api + +import org.intellij.lang.annotations.Language +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.ColumnsSelector +import org.jetbrains.kotlinx.dataframe.DataColumn +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.DataRow +import org.jetbrains.kotlinx.dataframe.columns.ColumnAccessor +import org.jetbrains.kotlinx.dataframe.columns.ColumnReference +import org.jetbrains.kotlinx.dataframe.columns.ColumnSet +import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath +import org.jetbrains.kotlinx.dataframe.columns.toColumnSet +import org.jetbrains.kotlinx.dataframe.impl.api.splitDefault +import org.jetbrains.kotlinx.dataframe.impl.api.splitImpl +import org.jetbrains.kotlinx.dataframe.impl.api.withRowCellImpl +import org.jetbrains.kotlinx.dataframe.impl.asList +import org.jetbrains.kotlinx.dataframe.impl.columnName +import org.jetbrains.kotlinx.dataframe.impl.getListType +import kotlin.reflect.KProperty +import kotlin.reflect.KType +import kotlin.reflect.typeOf + +public fun DataFrame.split(columns: ColumnsSelector): Split = Split(this, columns) + +public fun DataFrame.split(vararg columns: String): Split = split { columns.toColumnSet() } + +public fun DataFrame.split(vararg columns: ColumnReference): Split = split { columns.toColumnSet() } + +public fun DataFrame.split(vararg columns: KProperty): Split = split { columns.toColumnSet() } + +public class Split(internal val df: DataFrame, internal val columns: ColumnsSelector) { + public fun