Skip to content

Commit e8245f9

Browse files
committed
Merge branch 'master' into kotlin.time.Instant
# Conflicts: # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt # core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/api/format.kt # core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt # docs/StardustDocs/resources/modify/operations/formatExample_properties.html # docs/StardustDocs/resources/modify/operations/formatExample_strings.html
2 parents efb0adc + bfc4a25 commit e8245f9

File tree

176 files changed

+4209
-557
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+4209
-557
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
.kotlin
99
build
1010
.ipynb_checkpoints
11+
local.properties

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,9 @@ kotlin {
155155
val modulesUsingJava11 = with(projects) {
156156
setOf(
157157
dataframeJupyter,
158-
dataframeGeo,
158+
dataframeGeoJupyter,
159159
examples.ideaExamples.titanic,
160+
examples.ideaExamples.unsupportedDataSources,
160161
tests,
161162
plugins.dataframeGradlePlugin,
162163
)

core/api/core.api

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -909,6 +909,7 @@ public abstract interface class org/jetbrains/kotlinx/dataframe/api/ColsAtAnyDep
909909
}
910910

911911
public abstract interface class org/jetbrains/kotlinx/dataframe/api/ColsColumnsSelectionDsl {
912+
public fun cols (Ljava/lang/String;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
912913
public fun cols (Ljava/lang/String;I[I)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
913914
public fun cols (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
914915
public fun cols (Ljava/lang/String;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
@@ -923,36 +924,35 @@ public abstract interface class org/jetbrains/kotlinx/dataframe/api/ColsColumnsS
923924
public fun cols (Lkotlin/reflect/KProperty;Lkotlin/reflect/KProperty;[Lkotlin/reflect/KProperty;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
924925
public fun cols (Lkotlin/reflect/KProperty;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;[Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
925926
public fun cols (Lkotlin/reflect/KProperty;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnReference;[Lorg/jetbrains/kotlinx/dataframe/columns/ColumnReference;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
927+
public fun cols (Lorg/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
926928
public fun cols (Lorg/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl;I[I)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
927929
public fun cols (Lorg/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl;Ljava/lang/String;[Ljava/lang/String;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
928930
public fun cols (Lorg/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
929931
public fun cols (Lorg/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl;Lkotlin/ranges/IntRange;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
930932
public fun cols (Lorg/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl;Lkotlin/reflect/KProperty;[Lkotlin/reflect/KProperty;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
931933
public fun cols (Lorg/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;[Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
932934
public fun cols (Lorg/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnReference;[Lorg/jetbrains/kotlinx/dataframe/columns/ColumnReference;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
935+
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
933936
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;I[I)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
934937
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;Ljava/lang/String;[Ljava/lang/String;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
935938
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
936939
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;Lkotlin/ranges/IntRange;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
937940
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;Lkotlin/reflect/KProperty;[Lkotlin/reflect/KProperty;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
938941
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;[Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
939942
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnReference;[Lorg/jetbrains/kotlinx/dataframe/columns/ColumnReference;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
943+
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
940944
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;I[I)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
941945
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
942946
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;Lkotlin/ranges/IntRange;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
947+
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/SingleColumn;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
943948
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/SingleColumn;I[I)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
944949
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/SingleColumn;Ljava/lang/String;[Ljava/lang/String;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
945950
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/SingleColumn;Lkotlin/jvm/functions/Function1;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
946951
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/SingleColumn;Lkotlin/ranges/IntRange;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
947952
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/SingleColumn;Lkotlin/reflect/KProperty;[Lkotlin/reflect/KProperty;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
948953
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/SingleColumn;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;[Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
949954
public fun cols (Lorg/jetbrains/kotlinx/dataframe/columns/SingleColumn;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnReference;[Lorg/jetbrains/kotlinx/dataframe/columns/ColumnReference;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
950-
public static synthetic fun cols$default (Lorg/jetbrains/kotlinx/dataframe/api/ColsColumnsSelectionDsl;Ljava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
951955
public static synthetic fun cols$default (Lorg/jetbrains/kotlinx/dataframe/api/ColsColumnsSelectionDsl;Lkotlin/reflect/KProperty;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
952-
public static synthetic fun cols$default (Lorg/jetbrains/kotlinx/dataframe/api/ColsColumnsSelectionDsl;Lorg/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
953-
public static synthetic fun cols$default (Lorg/jetbrains/kotlinx/dataframe/api/ColsColumnsSelectionDsl;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnPath;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
954-
public static synthetic fun cols$default (Lorg/jetbrains/kotlinx/dataframe/api/ColsColumnsSelectionDsl;Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
955-
public static synthetic fun cols$default (Lorg/jetbrains/kotlinx/dataframe/api/ColsColumnsSelectionDsl;Lorg/jetbrains/kotlinx/dataframe/columns/SingleColumn;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
956956
public fun colsUnTyped (Ljava/lang/String;I[I)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
957957
public fun colsUnTyped (Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;
958958
public fun colsUnTyped (Ljava/lang/String;Lkotlin/ranges/IntRange;)Lorg/jetbrains/kotlinx/dataframe/columns/ColumnSet;

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataFrame.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@ public interface DataFrame<out T> :
6868

6969
// region rows
7070

71+
/**
72+
* Returns the total number of rows of this [DataFrame].
73+
*
74+
* @return The number of rows in the [DataFrame].
75+
*/
7176
public fun rowsCount(): Int
7277

7378
public operator fun iterator(): Iterator<DataRow<T>> = rows().iterator()

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cols.kt

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import org.jetbrains.kotlinx.dataframe.impl.columns.TransformableColumnSet
1616
import org.jetbrains.kotlinx.dataframe.impl.columns.transform
1717
import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle
1818
import org.jetbrains.kotlinx.dataframe.impl.headPlusArray
19+
import org.jetbrains.kotlinx.dataframe.util.COLS_TO_ALL
20+
import org.jetbrains.kotlinx.dataframe.util.COLS_TO_ALL_COLS
21+
import org.jetbrains.kotlinx.dataframe.util.COLS_TO_ALL_COLS_REPLACE
22+
import org.jetbrains.kotlinx.dataframe.util.COLS_TO_ALL_REPLACE
1923
import org.jetbrains.kotlinx.dataframe.util.DEPRECATED_ACCESS_API
2024
import kotlin.reflect.KProperty
2125

@@ -419,9 +423,12 @@ public interface ColsColumnsSelectionDsl<out _UNUSED> {
419423
* @see [ColumnsSelectionDsl.all]
420424
* @see [ColumnsSelectionDsl.filter] */
421425
@Suppress("UNCHECKED_CAST")
422-
public fun <C> ColumnSet<C>.cols(predicate: ColumnFilter<C> = { true }): ColumnSet<C> =
426+
public fun <C> ColumnSet<C>.cols(predicate: ColumnFilter<C>): ColumnSet<C> =
423427
colsInternal(predicate as ColumnFilter<*>).cast()
424428

429+
@Deprecated(COLS_TO_ALL, ReplaceWith(COLS_TO_ALL_REPLACE), DeprecationLevel.ERROR)
430+
public fun <C> ColumnSet<C>.cols(): ColumnSet<C> = cols { true }
431+
425432
/** ## Cols
426433
* Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this].
427434
*
@@ -571,9 +578,12 @@ public interface ColsColumnsSelectionDsl<out _UNUSED> {
571578
* @see [ColumnsSelectionDsl.frameCols]
572579
* @see [ColumnsSelectionDsl.colGroups]
573580
* @see [ColumnsSelectionDsl.all] */
574-
public fun ColumnsSelectionDsl<*>.cols(predicate: ColumnFilter<*> = { true }): ColumnSet<*> =
581+
public fun ColumnsSelectionDsl<*>.cols(predicate: ColumnFilter<*>): ColumnSet<*> =
575582
this.asSingleColumn().colsInternal(predicate)
576583

584+
@Deprecated(COLS_TO_ALL, ReplaceWith(COLS_TO_ALL_REPLACE), DeprecationLevel.ERROR)
585+
public fun ColumnsSelectionDsl<*>.cols(): ColumnSet<*> = cols { true }
586+
577587
/** ## Cols
578588
* Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this].
579589
*
@@ -723,9 +733,12 @@ public interface ColsColumnsSelectionDsl<out _UNUSED> {
723733
* @see [ColumnsSelectionDsl.frameCols]
724734
* @see [ColumnsSelectionDsl.colGroups]
725735
* @see [ColumnsSelectionDsl.allCols] */
726-
public fun SingleColumn<DataRow<*>>.cols(predicate: ColumnFilter<*> = { true }): ColumnSet<*> =
736+
public fun SingleColumn<DataRow<*>>.cols(predicate: ColumnFilter<*>): ColumnSet<*> =
727737
this.ensureIsColumnGroup().colsInternal(predicate)
728738

739+
@Deprecated(COLS_TO_ALL_COLS, ReplaceWith(COLS_TO_ALL_COLS_REPLACE), DeprecationLevel.ERROR)
740+
public fun SingleColumn<DataRow<*>>.cols(): ColumnSet<*> = cols { true }
741+
729742
/**
730743
* ## Cols
731744
* Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this].
@@ -869,7 +882,10 @@ public interface ColsColumnsSelectionDsl<out _UNUSED> {
869882
* @see [ColumnsSelectionDsl.frameCols]
870883
* @see [ColumnsSelectionDsl.colGroups]
871884
*/
872-
public fun String.cols(predicate: ColumnFilter<*> = { true }): ColumnSet<*> = columnGroup(this).cols(predicate)
885+
public fun String.cols(predicate: ColumnFilter<*>): ColumnSet<*> = columnGroup(this).cols(predicate)
886+
887+
@Deprecated(COLS_TO_ALL_COLS, ReplaceWith(COLS_TO_ALL_COLS_REPLACE), DeprecationLevel.ERROR)
888+
public fun String.cols(): ColumnSet<*> = cols { true }
873889

874890
/** ## Cols
875891
* Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this].
@@ -1149,7 +1165,10 @@ public interface ColsColumnsSelectionDsl<out _UNUSED> {
11491165
* @see [ColumnsSelectionDsl.frameCols]
11501166
* @see [ColumnsSelectionDsl.colGroups]
11511167
*/
1152-
public fun ColumnPath.cols(predicate: ColumnFilter<*> = { true }): ColumnSet<*> = columnGroup(this).cols(predicate)
1168+
public fun ColumnPath.cols(predicate: ColumnFilter<*>): ColumnSet<*> = columnGroup(this).cols(predicate)
1169+
1170+
@Deprecated(COLS_TO_ALL_COLS, ReplaceWith(COLS_TO_ALL_COLS_REPLACE), DeprecationLevel.ERROR)
1171+
public fun ColumnPath.cols(): ColumnSet<*> = cols { true }
11531172

11541173
/** ## Cols
11551174
* Creates a subset of columns ([ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet]) from [this].

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/constructors.kt

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,24 @@ public inline fun <reified T> columnOf(vararg values: T): DataColumn<T> =
261261

262262
public fun columnOf(vararg values: AnyBaseCol): DataColumn<AnyRow> = columnOf(values.asIterable()).forceResolve()
263263

264+
/**
265+
* Example:
266+
* ```kotlin
267+
* val columnGroup = columnOf(
268+
* "a" to columnOf("a1", "a2", "a3"),
269+
* "b" to columnOf(1, 2, 3),
270+
* )
271+
* ```
272+
*/
273+
@Refine
274+
@Interpretable("ColumnOfPairs")
275+
public fun columnOf(vararg columns: Pair<String, AnyBaseCol>): ColumnGroup<*> =
276+
dataFrameOf(
277+
columns.map { (name, col) ->
278+
col.rename(name)
279+
},
280+
).asColumnGroup()
281+
264282
public fun <T> columnOf(vararg frames: DataFrame<T>): FrameColumn<T> = columnOf(frames.asIterable()).forceResolve()
265283

266284
public fun columnOf(columns: Iterable<AnyBaseCol>): DataColumn<AnyRow> =
@@ -284,15 +302,6 @@ public inline fun <reified T> column(values: Iterable<T>): DataColumn<T> =
284302
allColsMakesColGroup = true,
285303
).forceResolve()
286304

287-
@Refine
288-
@Interpretable("ColumnOfPairs")
289-
public fun columnOf(vararg columns: Pair<String, AnyBaseCol>): ColumnGroup<*> =
290-
dataFrameOf(
291-
columns.map { (name, col) ->
292-
col.rename(name)
293-
},
294-
).asColumnGroup()
295-
296305
// endregion
297306

298307
// region create DataFrame
@@ -314,6 +323,18 @@ public fun dataFrameOf(columns: Iterable<AnyBaseCol>): DataFrame<*> {
314323
return DataFrameImpl<Unit>(cols, nrow)
315324
}
316325

326+
/**
327+
* Example:
328+
* ```kotlin
329+
* val df = dataFrameOf(
330+
* "a" to columnOf(1, 2),
331+
* "b" to columnOf(1.0, 2.0),
332+
* "group" to columnOf(
333+
* "nestedA" to columnOf("42", "abc"),
334+
* )
335+
* )
336+
* ```
337+
*/
317338
@Refine
318339
@JvmName("dataFrameOfColumns")
319340
@Interpretable("DataFrameOfPairs")

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/convert.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ public inline fun <T, C, reified R> Convert<T, C>.with(
599599
* df.convert { name }.asFrame { it.add("fullName") { "$firstName $lastName" } }
600600
* ```
601601
*
602-
* @param [expression] The [Data Frame Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenDataFrame.DataFrameExpression] to replace the selected column group with.
602+
* @param [expression] The [DataFrame Expression][org.jetbrains.kotlinx.dataframe.documentation.ExpressionsGivenDataFrame.DataFrameExpression] to replace the selected column group with.
603603
*/
604604
@Refine
605605
@Interpretable("ConvertAsFrame")

0 commit comments

Comments
 (0)