Skip to content

Commit 4bbaf0f

Browse files
Merge branch 'master' into website_docs_landing
# Conflicts: # docs/StardustDocs/topics/DataColumn.md
2 parents 89f0dc8 + b8048bb commit 4bbaf0f

File tree

326 files changed

+9759
-5064
lines changed

Some content is hidden

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

326 files changed

+9759
-5064
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ Kotlin DataFrame aims to reconcile Kotlin's static typing with the dynamic natur
2222

2323
Integrates with [Kotlin kernel for Jupyter](https://github.com/Kotlin/kotlin-jupyter). Inspired by [krangl](https://github.com/holgerbrandl/krangl), Kotlin Collections and [pandas](https://pandas.pydata.org/)
2424

25-
## Do you use Kotlin DataFrame or have you used it in the past?
26-
Join us for a one-hour interview and get a USD 100 Amazon Gift Card or a one-year JetBrains All Products Pack subscription.
27-
Simply [fill out a form](https://surveys.jetbrains.com/s3/kdf) and schedule a session if your profile matches our study criteria.
28-
2925
## Documentation
3026

3127
Explore [**documentation**](https://kotlin.github.io/dataframe/overview.html) for details.

build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,13 @@ configurations {
5050

5151
dependencies {
5252
api(projects.core)
53+
54+
// expose all optional IO dependencies by default
5355
api(projects.dataframeArrow)
5456
api(projects.dataframeExcel)
5557
api(projects.dataframeJdbc)
5658
api(projects.dataframeCsv)
59+
api(projects.dataframeJson)
5760

5861
// experimental, so not included by default:
5962
// api(projects.dataframeOpenapi)
@@ -64,6 +67,7 @@ dependencies {
6467
kover(projects.dataframeOpenapi)
6568
kover(projects.dataframeJdbc)
6669
kover(projects.dataframeCsv)
70+
kover(projects.dataframeJson)
6771
kover(projects.plugins.kotlinDataframe)
6872
kover(projects.dataframeJupyter)
6973
}

core/api/core.api

Lines changed: 62 additions & 102 deletions
Large diffs are not rendered by default.

core/build.gradle.kts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ dependencies {
6666
api(libs.commonsCsv)
6767

6868
implementation(libs.commonsIo)
69-
implementation(libs.serialization.core)
70-
implementation(libs.serialization.json)
7169
implementation(libs.fastDoubleParser)
7270

7371
api(libs.kotlin.datetimeJvm)
@@ -82,6 +80,9 @@ dependencies {
8280
testImplementation(libs.kotlin.scriptingJvm)
8381
testImplementation(libs.jsoup)
8482
testImplementation(libs.sl4jsimple)
83+
testImplementation(projects.dataframeJson)
84+
testImplementation(libs.serialization.core)
85+
testImplementation(libs.serialization.json)
8586

8687
// for checking results
8788
testImplementation(libs.commonsStatisticsDescriptive)
@@ -315,9 +316,6 @@ korro {
315316
funSuffix("_properties") {
316317
replaceText("NAME", "Properties")
317318
}
318-
funSuffix("_accessors") {
319-
replaceText("NAME", "Accessors")
320-
}
321319
funSuffix("_strings") {
322320
replaceText("NAME", "Strings")
323321
}

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,15 @@ public interface ColumnsContainer<out T> : ColumnsScope<T> {
4343

4444
public fun getColumnOrNull(index: Int): AnyCol?
4545

46+
@Deprecated(
47+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
48+
)
4649
@AccessApiOverload
4750
public fun <R> getColumnOrNull(column: ColumnReference<R>): DataColumn<R>?
4851

52+
@Deprecated(
53+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
54+
)
4955
@AccessApiOverload
5056
public fun <R> getColumnOrNull(column: KProperty<R>): DataColumn<R>?
5157

@@ -61,31 +67,58 @@ public interface ColumnsContainer<out T> : ColumnsScope<T> {
6167

6268
public operator fun get(columnPath: ColumnPath): AnyCol = getColumn(columnPath)
6369

70+
@Deprecated(
71+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
72+
)
6473
@AccessApiOverload
6574
public operator fun <R> get(column: DataColumn<R>): DataColumn<R> = getColumn(column.name()).cast()
6675

76+
@Deprecated(
77+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
78+
)
6779
@AccessApiOverload
6880
public operator fun <R> get(column: DataColumn<DataRow<R>>): ColumnGroup<R> = getColumn(column)
6981

82+
@Deprecated(
83+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
84+
)
7085
@AccessApiOverload
7186
public operator fun <R> get(column: DataColumn<DataFrame<R>>): FrameColumn<R> = getColumn(column)
7287

88+
@Deprecated(
89+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
90+
)
7391
@AccessApiOverload
7492
public operator fun <R> get(column: ColumnReference<R>): DataColumn<R> = getColumn(column)
7593

94+
@Deprecated(
95+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
96+
)
7697
@AccessApiOverload
7798
public operator fun <R> get(column: ColumnReference<DataRow<R>>): ColumnGroup<R> = getColumn(column)
7899

100+
@Deprecated(
101+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
102+
)
79103
@AccessApiOverload
80104
public operator fun <R> get(column: ColumnReference<DataFrame<R>>): FrameColumn<R> = getColumn(column)
81105

106+
@Deprecated(
107+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
108+
)
82109
@AccessApiOverload
83110
public operator fun <R> get(column: KProperty<R>): DataColumn<R> = get(column.columnName).cast()
84111

112+
@Deprecated(
113+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
114+
)
85115
@AccessApiOverload
86116
public operator fun <R> get(column: KProperty<DataRow<R>>): ColumnGroup<R> =
87117
get(column.columnName).asColumnGroup().cast()
88118

119+
@Deprecated(
120+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
121+
)
89122
@AccessApiOverload
90123
public operator fun <R> get(column: KProperty<DataFrame<R>>): FrameColumn<R> =
91124
get(column.columnName).asAnyFrameColumn().castFrameColumn()

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ public interface DataFrame<out T> :
121121
*/
122122
public operator fun <T, C> DataFrame<T>.get(columns: ColumnsSelector<T, C>): List<DataColumn<C>> = this.get(columns)
123123

124+
@Deprecated(
125+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
126+
)
124127
@AccessApiOverload
125128
public operator fun <T> DataFrame<T>.get(first: AnyColumnReference, vararg other: AnyColumnReference): DataFrame<T> =
126129
select { (listOf(first) + other).toColumnSet() }

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,27 @@ public interface DataRow<out T> {
2828

2929
public operator fun <R> get(expression: RowExpression<T, R>): R = expression(this, this)
3030

31+
@Deprecated(
32+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
33+
)
3134
@AccessApiOverload
3235
public operator fun <R> get(column: ColumnReference<R>): R
3336

37+
@Deprecated(
38+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
39+
)
3440
@AccessApiOverload
3541
public operator fun <R> get(columns: List<ColumnReference<R>>): List<R> = columns.map { get(it) }
3642

43+
@Deprecated(
44+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
45+
)
3746
@AccessApiOverload
3847
public operator fun <R> get(property: KProperty<R>): R = get(property.columnName) as R
3948

49+
@Deprecated(
50+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
51+
)
4052
@AccessApiOverload
4153
public operator fun get(first: AnyColumnReference, vararg other: AnyColumnReference): DataRow<T> =
4254
owner.get(first, *other)[index]
@@ -71,6 +83,9 @@ public interface DataRow<out T> {
7183

7284
public fun getOrNull(name: String): Any?
7385

86+
@Deprecated(
87+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
88+
)
7489
@AccessApiOverload
7590
public fun <R> getValueOrNull(column: ColumnReference<R>): R?
7691

@@ -80,6 +95,9 @@ public interface DataRow<out T> {
8095

8196
public operator fun String.get(vararg path: String): ColumnPath = ColumnPath(listOf(this) + path)
8297

98+
@Deprecated(
99+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
100+
)
83101
@AccessApiOverload
84102
public operator fun <R> ColumnReference<R>.invoke(): R = get(this)
85103

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import org.jetbrains.kotlinx.dataframe.api.KeyValueProperty
55
import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup
66
import org.jetbrains.kotlinx.dataframe.columns.FrameColumn
77
import org.jetbrains.kotlinx.dataframe.documentation.UnifyingNumbers
8-
import org.jetbrains.kotlinx.dataframe.io.JSON
98

109
/**
1110
* Annotation preprocessing will generate a DataSchema interface from the data at `path`.
@@ -73,8 +72,11 @@ public annotation class JdbcOptions(
7372
)
7473

7574
public annotation class JsonOptions(
76-
/** Allows the choice of how to handle type clashes when reading a JSON file. */
77-
public val typeClashTactic: JSON.TypeClashTactic = JSON.TypeClashTactic.ARRAY_AND_VALUE_COLUMNS,
75+
/**
76+
* Allows the choice of how to handle type clashes when reading a JSON file.
77+
* Must be either [JsonOptions.TypeClashTactics.ARRAY_AND_VALUE_COLUMNS] or [JsonOptions.TypeClashTactics.ANY_COLUMNS]
78+
* */
79+
public val typeClashTactic: String = TypeClashTactics.ARRAY_AND_VALUE_COLUMNS,
7880
/**
7981
* List of [JsonPath]s where instead of a [ColumnGroup], a [FrameColumn]<[KeyValueProperty]>
8082
* will be created.
@@ -85,4 +87,9 @@ public annotation class JsonOptions(
8587
public val keyValuePaths: Array<String> = [],
8688
/** Whether to [unify the numbers that are read][UnifyingNumbers]. `true` by default. */
8789
public val unifyNumbers: Boolean = true,
88-
)
90+
) {
91+
public object TypeClashTactics {
92+
public const val ARRAY_AND_VALUE_COLUMNS: String = "ARRAY_AND_VALUE_COLUMNS"
93+
public const val ANY_COLUMNS: String = "ANY_COLUMNS"
94+
}
95+
}

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
8686
* @throws [IllegalArgumentException] if the column is not found.
8787
* @return The [DataColumn] this [KProperty Accessor][KProperty] points to.
8888
*/
89+
@Deprecated(
90+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
91+
)
8992
@AccessApiOverload
9093
public operator fun <T> KProperty<T>.invoke(): DataColumn<T> = this@ColumnSelectionDsl[this]
9194

@@ -96,6 +99,9 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
9699
* @throws [IllegalArgumentException] if the column is not found.
97100
* @return The [ColumnGroup] this [KProperty Accessor][KProperty] points to.
98101
*/
102+
@Deprecated(
103+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
104+
)
99105
@AccessApiOverload
100106
public operator fun <T> KProperty<DataRow<T>>.invoke(): ColumnGroup<T> = this@ColumnSelectionDsl[this]
101107

@@ -106,6 +112,9 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
106112
* @throws [IllegalArgumentException] if the column is not found.
107113
* @return The [FrameColumn] this [KProperty Accessor][KProperty] points to.
108114
*/
115+
@Deprecated(
116+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
117+
)
109118
@AccessApiOverload
110119
public operator fun <T> KProperty<DataFrame<T>>.invoke(): FrameColumn<T> = this@ColumnSelectionDsl[this]
111120

@@ -140,6 +149,9 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
140149
*/
141150
@Suppress("INAPPLICABLE_JVM_NAME")
142151
@JvmName("KPropertyDataRowGet")
152+
@Deprecated(
153+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
154+
)
143155
@AccessApiOverload
144156
public operator fun <T, R> KProperty<DataRow<T>>.get(column: KProperty<R>): DataColumn<R> = invoke()[column]
145157

@@ -159,6 +171,9 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
159171
*/
160172
@Suppress("INAPPLICABLE_JVM_NAME")
161173
@JvmName("KPropertyDataRowGet")
174+
@Deprecated(
175+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
176+
)
162177
@AccessApiOverload
163178
public operator fun <T, R> KProperty<DataRow<T>>.get(column: KProperty<DataRow<R>>): ColumnGroup<R> =
164179
invoke()[column]
@@ -179,6 +194,9 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
179194
*/
180195
@Suppress("INAPPLICABLE_JVM_NAME")
181196
@JvmName("KPropertyDataRowGet")
197+
@Deprecated(
198+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
199+
)
182200
@AccessApiOverload
183201
public operator fun <T, R> KProperty<DataRow<T>>.get(column: KProperty<DataFrame<R>>): FrameColumn<R> =
184202
invoke()[column]
@@ -197,6 +215,9 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
197215
* @throws [IllegalArgumentException] if the column is not found.
198216
* @return The [DataColumn] these [KProperty Accessors][KProperty] point to.
199217
*/
218+
@Deprecated(
219+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
220+
)
200221
@AccessApiOverload
201222
public operator fun <T, R> KProperty<T>.get(column: KProperty<R>): DataColumn<R> = invoke().asColumnGroup()[column]
202223

@@ -214,6 +235,9 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
214235
* @throws [IllegalArgumentException] if the column is not found.
215236
* @return The [ColumnGroup] these [KProperty Accessors][KProperty] point to.
216237
*/
238+
@Deprecated(
239+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
240+
)
217241
@AccessApiOverload
218242
public operator fun <T, R> KProperty<T>.get(column: KProperty<DataRow<R>>): ColumnGroup<R> =
219243
invoke().asColumnGroup()[column]
@@ -232,6 +256,9 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
232256
* @throws [IllegalArgumentException] if the column is not found.
233257
* @return The [FrameColumn] these [KProperty Accessors][KProperty] point to.
234258
*/
259+
@Deprecated(
260+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
261+
)
235262
@AccessApiOverload
236263
public operator fun <T, R> KProperty<T>.get(column: KProperty<DataFrame<R>>): FrameColumn<R> =
237264
invoke().asColumnGroup()[column]

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,9 @@ public interface ColumnsSelectionDsl<out T> : // SingleColumn<DataRow<T>>
492492
* @return A [ColumnSet][org.jetbrains.kotlinx.dataframe.columns.ColumnSet] containing the columns selected by [selector].
493493
* @see [SingleColumn.except]
494494
*/
495+
@Deprecated(
496+
"Recommended to migrate to use String or Extension properties API https://kotlin.github.io/dataframe/apilevels.html",
497+
)
495498
@AccessApiOverload
496499
public operator fun <C, R> KProperty<C>.invoke(selector: ColumnsSelector<C, R>): ColumnSet<R> =
497500
columnGroup(this).select(selector)

0 commit comments

Comments
 (0)