diff --git a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Modify.kt b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Modify.kt index ffd880c486..9fe30f358d 100644 --- a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Modify.kt +++ b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Modify.kt @@ -73,6 +73,7 @@ import org.jetbrains.kotlinx.dataframe.api.remove import org.jetbrains.kotlinx.dataframe.api.rename import org.jetbrains.kotlinx.dataframe.api.reorder import org.jetbrains.kotlinx.dataframe.api.replace +import org.jetbrains.kotlinx.dataframe.api.replaceAll import org.jetbrains.kotlinx.dataframe.api.reverse import org.jetbrains.kotlinx.dataframe.api.schema import org.jetbrains.kotlinx.dataframe.api.select @@ -174,6 +175,18 @@ class Modify : TestBase() { // SampleEnd } + @Test + @TransformDataFrameExpressions + fun replaceAll() { + // SampleStart + functions.replaceAll( + "DataFrame<*>" to "DataFrame", + "DataRow<*>" to "DataRow", + "AnyRow" to "DataRow", + ) { receiverType and returnType } + // SampleEnd + } + @Test @TransformDataFrameExpressions fun convert() { diff --git a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/TestBase.kt b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/TestBase.kt index d09e21f1ee..379d7d321e 100644 --- a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/TestBase.kt +++ b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/TestBase.kt @@ -3,6 +3,7 @@ package org.jetbrains.kotlinx.dataframe.samples.api import io.kotest.matchers.should import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldNotBe +import org.jetbrains.kotlinx.dataframe.DataFrame import org.jetbrains.kotlinx.dataframe.DataRow import org.jetbrains.kotlinx.dataframe.annotations.DataSchema import org.jetbrains.kotlinx.dataframe.api.asColumnGroup @@ -18,6 +19,7 @@ import org.jetbrains.kotlinx.dataframe.api.to import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath import org.jetbrains.kotlinx.dataframe.explainer.PluginCallbackProxy import org.jetbrains.kotlinx.dataframe.impl.columns.asValueColumn +import org.jetbrains.kotlinx.dataframe.io.readJsonStr import org.junit.After import org.junit.Before @@ -108,6 +110,113 @@ public open class TestBase { infix fun T.willBe(expected: U?) = shouldBe(expected) + @DataSchema + interface Functions { + val receiverType: String + val name: String + val parameters: List + val returnType: String + } + + val functions = DataFrame.readJsonStr(""" + [{ + "receiverType": "DataRow<*>", + "name": "rowStd", + "parameters": ["skipNA: Boolean = skipNA_default", "ddof: Int = ddof_default"], + "returnType": "Double" + }, { + "receiverType": "DataRow<*>", + "name": "rowStdOf", + "parameters": ["ddof: Int = ddof_default"], + "returnType": "Double" + }, { + "receiverType": "DataFrame", + "name": "stdFor", + "parameters": ["skipNA: Boolean = skipNA_default", "ddof: Int = ddof_default", "columns: ColumnsForAggregateSelector"], + "returnType": "DataRow" + }, { + "receiverType": "DataFrame", + "name": "replace", + "parameters": ["columns: ColumnsSelector"], + "returnType": "ReplaceClause" + }, { + "receiverType": "DataFrame", + "name": "copy", + "parameters": [], + "returnType": "DataFrame" + },{ + "receiverType": "AnyRow", + "name": "transposeTo", + "parameters": [], + "returnType": "DataFrame" + }, { + "receiverType": "DataFrame", + "name": "tail", + "parameters": ["numRows: Int = 5"], + "returnType": "DataFrame" + }, { + "receiverType": "DataFrame", + "name": "mapToFrame", + "parameters": ["body: AddDsl.() -> Unit"], + "returnType": "AnyFrame" + }, { + "receiverType": "DataFrame", + "name": "asGroupBy", + "parameters": ["groupedColumnName: String"], + "returnType": "GroupBy" + }, { + "receiverType": "DataFrame", + "name": "select", + "parameters": ["columns: ColumnsSelector"], + "returnType": "DataFrame" + }, { + "receiverType": "DataFrame", + "name": "split", + "parameters": ["columns: ColumnsSelector"], + "returnType": "Split" + }, { + "receiverType": "DataRow<*>", + "name": "allNA", + "parameters": [], + "returnType": "Boolean" + }, { + "receiverType": "DataRow<*>", + "name": "rowMean", + "parameters": ["skipNA: Boolean = skipNA_default"], + "returnType": "Double" + }, { + "receiverType": "DataRow<*>", + "name": "rowMeanOf", + "parameters": [], + "returnType": "Double" + }, { + "receiverType": "DataFrame", + "name": "meanFor", + "parameters": ["skipNA: Boolean = skipNA_default", "columns: ColumnsForAggregateSelector"], + "returnType": "DataRow" + }, { + "receiverType": "DataFrame", + "name": "fillNulls", + "parameters": ["columns: ColumnsSelector"], + "returnType": "Update" + }, { + "receiverType": "DataFrame", + "name": "fillNaNs", + "parameters": ["columns: ColumnsSelector"], + "returnType": "Update" + }, { + "receiverType": "DataFrame", + "name": "fillNA", + "parameters": ["columns: ColumnsSelector"], + "returnType": "Update" + }, { + "receiverType": "DataFrame<*>", + "name": "toListOf", + "parameters": [], + "returnType": "List" + }] + """.trimIndent()).cast(verify = true) + /** * Asserts that all elements of the iterable are equal to each other */ diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Modify.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Modify.kt index ffd880c486..9fe30f358d 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Modify.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/Modify.kt @@ -73,6 +73,7 @@ import org.jetbrains.kotlinx.dataframe.api.remove import org.jetbrains.kotlinx.dataframe.api.rename import org.jetbrains.kotlinx.dataframe.api.reorder import org.jetbrains.kotlinx.dataframe.api.replace +import org.jetbrains.kotlinx.dataframe.api.replaceAll import org.jetbrains.kotlinx.dataframe.api.reverse import org.jetbrains.kotlinx.dataframe.api.schema import org.jetbrains.kotlinx.dataframe.api.select @@ -174,6 +175,18 @@ class Modify : TestBase() { // SampleEnd } + @Test + @TransformDataFrameExpressions + fun replaceAll() { + // SampleStart + functions.replaceAll( + "DataFrame<*>" to "DataFrame", + "DataRow<*>" to "DataRow", + "AnyRow" to "DataRow", + ) { receiverType and returnType } + // SampleEnd + } + @Test @TransformDataFrameExpressions fun convert() { diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/TestBase.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/TestBase.kt index d09e21f1ee..4d1acdabe4 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/TestBase.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/samples/api/TestBase.kt @@ -3,6 +3,7 @@ package org.jetbrains.kotlinx.dataframe.samples.api import io.kotest.matchers.should import io.kotest.matchers.shouldBe import io.kotest.matchers.shouldNotBe +import org.jetbrains.kotlinx.dataframe.DataFrame import org.jetbrains.kotlinx.dataframe.DataRow import org.jetbrains.kotlinx.dataframe.annotations.DataSchema import org.jetbrains.kotlinx.dataframe.api.asColumnGroup @@ -18,6 +19,7 @@ import org.jetbrains.kotlinx.dataframe.api.to import org.jetbrains.kotlinx.dataframe.columns.ColumnWithPath import org.jetbrains.kotlinx.dataframe.explainer.PluginCallbackProxy import org.jetbrains.kotlinx.dataframe.impl.columns.asValueColumn +import org.jetbrains.kotlinx.dataframe.io.readJsonStr import org.junit.After import org.junit.Before @@ -108,6 +110,115 @@ public open class TestBase { infix fun T.willBe(expected: U?) = shouldBe(expected) + @DataSchema + interface Functions { + val receiverType: String + val name: String + val parameters: List + val returnType: String + } + + val functions = DataFrame.readJsonStr( + """ + [{ + "receiverType": "DataRow<*>", + "name": "rowStd", + "parameters": ["skipNA: Boolean = skipNA_default", "ddof: Int = ddof_default"], + "returnType": "Double" + }, { + "receiverType": "DataRow<*>", + "name": "rowStdOf", + "parameters": ["ddof: Int = ddof_default"], + "returnType": "Double" + }, { + "receiverType": "DataFrame", + "name": "stdFor", + "parameters": ["skipNA: Boolean = skipNA_default", "ddof: Int = ddof_default", "columns: ColumnsForAggregateSelector"], + "returnType": "DataRow" + }, { + "receiverType": "DataFrame", + "name": "replace", + "parameters": ["columns: ColumnsSelector"], + "returnType": "ReplaceClause" + }, { + "receiverType": "DataFrame", + "name": "copy", + "parameters": [], + "returnType": "DataFrame" + },{ + "receiverType": "AnyRow", + "name": "transposeTo", + "parameters": [], + "returnType": "DataFrame" + }, { + "receiverType": "DataFrame", + "name": "tail", + "parameters": ["numRows: Int = 5"], + "returnType": "DataFrame" + }, { + "receiverType": "DataFrame", + "name": "mapToFrame", + "parameters": ["body: AddDsl.() -> Unit"], + "returnType": "AnyFrame" + }, { + "receiverType": "DataFrame", + "name": "asGroupBy", + "parameters": ["groupedColumnName: String"], + "returnType": "GroupBy" + }, { + "receiverType": "DataFrame", + "name": "select", + "parameters": ["columns: ColumnsSelector"], + "returnType": "DataFrame" + }, { + "receiverType": "DataFrame", + "name": "split", + "parameters": ["columns: ColumnsSelector"], + "returnType": "Split" + }, { + "receiverType": "DataRow<*>", + "name": "allNA", + "parameters": [], + "returnType": "Boolean" + }, { + "receiverType": "DataRow<*>", + "name": "rowMean", + "parameters": ["skipNA: Boolean = skipNA_default"], + "returnType": "Double" + }, { + "receiverType": "DataRow<*>", + "name": "rowMeanOf", + "parameters": [], + "returnType": "Double" + }, { + "receiverType": "DataFrame", + "name": "meanFor", + "parameters": ["skipNA: Boolean = skipNA_default", "columns: ColumnsForAggregateSelector"], + "returnType": "DataRow" + }, { + "receiverType": "DataFrame", + "name": "fillNulls", + "parameters": ["columns: ColumnsSelector"], + "returnType": "Update" + }, { + "receiverType": "DataFrame", + "name": "fillNaNs", + "parameters": ["columns: ColumnsSelector"], + "returnType": "Update" + }, { + "receiverType": "DataFrame", + "name": "fillNA", + "parameters": ["columns: ColumnsSelector"], + "returnType": "Update" + }, { + "receiverType": "DataFrame<*>", + "name": "toListOf", + "parameters": [], + "returnType": "List" + }] + """.trimIndent() + ).cast(verify = true) + /** * Asserts that all elements of the iterable are equal to each other */ diff --git a/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.pivotAggregate1.html b/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.pivotAggregate1.html index a4f3e43f94..c51c33f2cd 100644 --- a/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.pivotAggregate1.html +++ b/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.pivotAggregate1.html @@ -652,48 +652,48 @@ { name: "age", children: [], rightAlign: true, values: ["15.0","null","null"] }, { name: "weight", children: [], rightAlign: true, values: ["54.0","null","null"] }, { name: "\">means", children: [1, 2], rightAlign: false, values: ["{ age: 15.0, weight: 54.0 }","{ }","{ }"] }, -{ name: "age", children: [], rightAlign: true, values: ["NaN","null","null"] }, -{ name: "weight", children: [], rightAlign: true, values: ["NaN","null","null"] }, +{ name: "age", children: [], rightAlign: true, values: ["NaN","null","null"] }, +{ name: "weight", children: [], rightAlign: true, values: ["NaN","null","null"] }, { name: "\">stds", children: [4, 5], rightAlign: false, values: ["{ age: NaN, weight: NaN }","{ }","{ }"] }, { name: "biggest", children: [], rightAlign: false, values: ["Cooper","null","null"] }, { name: "\">London", children: [3, 6, 7], rightAlign: false, values: ["{ means: { age: 15.0, weight... }, ... }","{ }","{ }"] }, { name: "age", children: [], rightAlign: true, values: ["20.0","null","null"] }, { name: "weight", children: [], rightAlign: true, values: ["55.0","null","null"] }, { name: "\">means", children: [9, 10], rightAlign: false, values: ["{ age: 20.0, weight: 55.0 }","{ }","{ }"] }, -{ name: "age", children: [], rightAlign: true, values: ["NaN","null","null"] }, -{ name: "weight", children: [], rightAlign: true, values: ["NaN","null","null"] }, +{ name: "age", children: [], rightAlign: true, values: ["NaN","null","null"] }, +{ name: "weight", children: [], rightAlign: true, values: ["NaN","null","null"] }, { name: "\">stds", children: [12, 13], rightAlign: false, values: ["{ age: NaN, weight: NaN }","{ }","{ }"] }, { name: "biggest", children: [], rightAlign: false, values: ["Wolf","null","null"] }, { name: "\">null", children: [11, 14, 15], rightAlign: false, values: ["{ means: { age: 20.0, weight... }, ... }","{ }","{ }"] }, { name: "age", children: [], rightAlign: true, values: ["null","45.0","null"] }, { name: "weight", children: [], rightAlign: true, values: ["null","87.0","null"] }, { name: "\">means", children: [17, 18], rightAlign: false, values: ["{ }","{ age: 45.0, weight: 87.0 }","{ }"] }, -{ name: "age", children: [], rightAlign: true, values: ["null","NaN","null"] }, -{ name: "weight", children: [], rightAlign: true, values: ["null","NaN","null"] }, +{ name: "age", children: [], rightAlign: true, values: ["null","NaN","null"] }, +{ name: "weight", children: [], rightAlign: true, values: ["null","NaN","null"] }, { name: "\">stds", children: [20, 21], rightAlign: false, values: ["{ }","{ age: NaN, weight: NaN }","{ }"] }, { name: "biggest", children: [], rightAlign: false, values: ["null","Dylan","null"] }, { name: "\">Dubai", children: [19, 22, 23], rightAlign: false, values: ["{ }","{ means: { age: 45.0, weight... }, ... }","{ }"] }, { name: "age", children: [], rightAlign: true, values: ["null","30.0","null"] }, { name: "weight", children: [], rightAlign: true, values: ["null","68.0","null"] }, { name: "\">means", children: [25, 26], rightAlign: false, values: ["{ }","{ age: 30.0, weight: 68.0 }","{ }"] }, -{ name: "age", children: [], rightAlign: true, values: ["null","NaN","null"] }, -{ name: "weight", children: [], rightAlign: true, values: ["null","NaN","null"] }, +{ name: "age", children: [], rightAlign: true, values: ["null","NaN","null"] }, +{ name: "weight", children: [], rightAlign: true, values: ["null","NaN","null"] }, { name: "\">stds", children: [28, 29], rightAlign: false, values: ["{ }","{ age: NaN, weight: NaN }","{ }"] }, { name: "biggest", children: [], rightAlign: false, values: ["null","Marley","null"] }, { name: "\">Tokyo", children: [27, 30, 31], rightAlign: false, values: ["{ }","{ means: { age: 30.0, weight... }, ... }","{ }"] }, { name: "age", children: [], rightAlign: true, values: ["null","null","25.0"] }, { name: "weight", children: [], rightAlign: true, values: ["null","null","90.0"] }, { name: "\">means", children: [33, 34], rightAlign: false, values: ["{ }","{ }","{ age: 25.0, weight: 90.0 }"] }, -{ name: "age", children: [], rightAlign: true, values: ["null","null","7.071068e+00"] }, -{ name: "weight", children: [], rightAlign: true, values: ["null","null","NaN"] }, +{ name: "age", children: [], rightAlign: true, values: ["null","null","7.071068"] }, +{ name: "weight", children: [], rightAlign: true, values: ["null","null","NaN"] }, { name: "\">stds", children: [36, 37], rightAlign: false, values: ["{ }","{ }","{ age: 7.1, weight: NaN }"] }, { name: "biggest", children: [], rightAlign: false, values: ["null","null","Byrd"] }, { name: "\">Moscow", children: [35, 38, 39], rightAlign: false, values: ["{ }","{ }","{ means: { age: 25.0, weight... }, ... }"] }, { name: "age", children: [], rightAlign: true, values: ["null","null","40.0"] }, { name: "weight", children: [], rightAlign: true, values: ["null","null","NaN"] }, { name: "\">means", children: [41, 42], rightAlign: false, values: ["{ }","{ }","{ age: 40.0, weight: NaN }"] }, -{ name: "age", children: [], rightAlign: true, values: ["null","null","NaN"] }, -{ name: "weight", children: [], rightAlign: true, values: ["null","null","NaN"] }, +{ name: "age", children: [], rightAlign: true, values: ["null","null","NaN"] }, +{ name: "weight", children: [], rightAlign: true, values: ["null","null","NaN"] }, { name: "\">stds", children: [44, 45], rightAlign: false, values: ["{ }","{ }","{ age: NaN, weight: NaN }"] }, { name: "biggest", children: [], rightAlign: true, values: ["null","null","null"] }, { name: "\">Milan", children: [43, 46, 47], rightAlign: false, values: ["{ }","{ }","{ means: { age: 40.0, weigh... }, s... }"] }, diff --git a/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.pivotDefault.html b/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.pivotDefault.html index a614b52ada..949b09db27 100644 --- a/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.pivotDefault.html +++ b/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Analyze.pivotDefault.html @@ -997,27 +997,27 @@ { name: "\">name", children: [0, 1], rightAlign: false, values: ["{ firstName: Alice, lastName: Cooper }","{ firstName: Bob, lastName: Dylan }","{ firstName: Charlie, lastName: Dan... }","{ firstName: Charlie, lastName: Cha... }","{ firstName: Bob, lastName: Marley }","{ firstName: Alice, lastName: Wolf }","{ firstName: Charlie, lastName: Byrd }"] }, { name: "age", children: [], rightAlign: true, values: ["15","0","0","0","0","0","0"] }, { name: "weight", children: [], rightAlign: true, values: ["54","0","0","0","0","0","0"] }, -{ name: "isHappy", children: [], rightAlign: false, values: ["true","0","0","0","0","0","0"] }, +{ name: "\">isHappy", children: [], rightAlign: false, values: ["true","0","0","0","0","0","0"] }, { name: "\">London", children: [3, 4, 5], rightAlign: false, values: ["{ age: 15, weight: 54, isHappy: true }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }"] }, { name: "age", children: [], rightAlign: true, values: ["0","45","0","0","0","0","0"] }, { name: "weight", children: [], rightAlign: true, values: ["0","87","0","0","0","0","0"] }, -{ name: "isHappy", children: [], rightAlign: false, values: ["0","true","0","0","0","0","0"] }, +{ name: "\">isHappy", children: [], rightAlign: false, values: ["0","true","0","0","0","0","0"] }, { name: "\">Dubai", children: [7, 8, 9], rightAlign: false, values: ["{ age: 0, weight: 0, isHappy: 0 }","{ age: 45, weight: 87, isHappy: true }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }"] }, { name: "age", children: [], rightAlign: true, values: ["0","0","20","0","0","0","30"] }, { name: "weight", children: [], rightAlign: true, values: ["0","0","0","0","0","0","90"] }, -{ name: "isHappy", children: [], rightAlign: false, values: ["0","0","false","0","0","0","true"] }, +{ name: "\">isHappy", children: [], rightAlign: false, values: ["0","0","false","0","0","0","true"] }, { name: "\">Moscow", children: [11, 12, 13], rightAlign: false, values: ["{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 20, weight: 0, isHappy: false }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 30, weight: 90, isHappy: true }"] }, { name: "age", children: [], rightAlign: true, values: ["0","0","0","40","0","0","0"] }, { name: "weight", children: [], rightAlign: true, values: ["0","0","0","0","0","0","0"] }, -{ name: "isHappy", children: [], rightAlign: false, values: ["0","0","0","true","0","0","0"] }, +{ name: "\">isHappy", children: [], rightAlign: false, values: ["0","0","0","true","0","0","0"] }, { name: "\">Milan", children: [15, 16, 17], rightAlign: false, values: ["{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 40, weight: 0, isHappy: true }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }"] }, { name: "age", children: [], rightAlign: true, values: ["0","0","0","0","30","0","0"] }, { name: "weight", children: [], rightAlign: true, values: ["0","0","0","0","68","0","0"] }, -{ name: "isHappy", children: [], rightAlign: false, values: ["0","0","0","0","true","0","0"] }, +{ name: "\">isHappy", children: [], rightAlign: false, values: ["0","0","0","0","true","0","0"] }, { name: "\">Tokyo", children: [19, 20, 21], rightAlign: false, values: ["{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 30, weight: 68, isHappy: true }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }"] }, { name: "age", children: [], rightAlign: true, values: ["0","0","0","0","0","20","0"] }, { name: "weight", children: [], rightAlign: true, values: ["0","0","0","0","0","55","0"] }, -{ name: "isHappy", children: [], rightAlign: false, values: ["0","0","0","0","0","false","0"] }, +{ name: "\">isHappy", children: [], rightAlign: false, values: ["0","0","0","0","0","false","0"] }, { name: "\">null", children: [23, 24, 25], rightAlign: false, values: ["{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 0, weight: 0, isHappy: 0 }","{ age: 20, weight: 55, isHappy: false }","{ age: 0, weight: 0, isHappy: 0 }"] }, { name: "\">city", children: [6, 10, 14, 18, 22, 26], rightAlign: false, values: ["{ London: { age: 15, w..., i... }, ... }","{ London: { age: 0, we..., i... }, ... }","{ London: { age: 0, we..., i... }, ... }","{ London: { age: 0, we..., i... }, ... }","{ London: { age: 0, we..., i... }, ... }","{ London: { age: 0, we..., i... }, ... }","{ London: { age: 0, we..., i... }, ... }"] }, ], id: 41, rootId: 41, totalRows: 7 } ) }); diff --git a/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.replaceAll.html b/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.replaceAll.html new file mode 100644 index 0000000000..c203730ee5 --- /dev/null +++ b/docs/StardustDocs/snippets/org.jetbrains.kotlinx.dataframe.samples.api.Modify.replaceAll.html @@ -0,0 +1,488 @@ + + + + + +
+ Input DataFrame: rowsCount = 19, columnsCount = 4 +
+ +

+
+
+ Output DataFrame: rowsCount = 19, columnsCount = 4 +
+ +

+
+ + + diff --git a/docs/StardustDocs/topics/update.md b/docs/StardustDocs/topics/update.md index 450699a0bd..648a267ddd 100644 --- a/docs/StardustDocs/topics/update.md +++ b/docs/StardustDocs/topics/update.md @@ -42,6 +42,21 @@ df.update { city }.where { name.firstName == "Alice" }.with { "Paris" } +Update with mapping: + + + +```kotlin +functions.replaceAll( + "DataFrame<*>" to "DataFrame", + "DataRow<*>" to "DataRow", + "AnyRow" to "DataRow", +) { receiverType and returnType } +``` + + + + Update with value depending on row: