You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use `newValue()` function to access value that was already calculated for preceding row. It is helpful for recurrent computations:
47
+
You can use the `newValue()` function to access value that was already calculated for the preceding row.
48
+
It is helpful for recurrent computations:
48
49
49
50
<!---FUN addRecurrent-->
50
51
@@ -223,7 +224,9 @@ df.add(df1, df2)
223
224
224
225
## addId
225
226
226
-
Adds column with sequential values 0, 1, 2,... New column will be added in the beginning of columns list and will become the first column in [`DataFrame`](DataFrame.md).
227
+
Adds a column with sequential values 0, 1, 2,...
228
+
The new column will be added in the beginning of the column list
229
+
and will become the first column in [`DataFrame`](DataFrame.md).
Changes type argument of [`DataFrame`](DataFrame.md) without changing its contents.
4
+
Changes the type argument of the [`DataFrame`](DataFrame.md) instance without changing its contents.
5
5
6
6
```kotlin
7
7
cast<T>(verify =false)
8
8
```
9
9
10
10
**Parameters:**
11
-
*`verify: Boolean = false` — when `true`, throws exception if [`DataFrame`](DataFrame.md) doesn't match given schema. Otherwise, just changes format type without actual data check.
11
+
*`verify: Boolean = false` —
12
+
when `true`, the function throws an exception if the [`DataFrame`](DataFrame.md) instance doesn't match the given schema.
13
+
Otherwise, it just changes the format type without actual data checks.
12
14
13
-
Use this operation to change formal type of [`DataFrame`](DataFrame.md) to match expected schema and enable generated [extension properties](extensionPropertiesApi.md) for it.
15
+
Use this operation to change the formal type of a [`DataFrame`](DataFrame.md) instance
16
+
to match the expected schema and enable generated [extension properties](extensionPropertiesApi.md) for it.
Copy file name to clipboardExpand all lines: docs/StardustDocs/topics/collectionsInterop.md
+16-8Lines changed: 16 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,16 +7,23 @@ _Kotlin DataFrame_ and _Kotlin Collection_ represent two different approaches to
7
7
*[`DataFrame`](DataFrame.md) stores data by fields/columns
8
8
*`Collection` stores data by records/rows
9
9
10
-
Although [`DataFrame`](DataFrame.md) doesn't implement [`Collection`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/#kotlin.collections.Collection) or [`Iterable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/) interface, it has many similar operations,
11
-
such as [`filter`](filter.md), [`take`](sliceRows.md#take), [`first`](first.md), [`map`](map.md), [`groupBy`](groupBy.md) etc.
10
+
Although [`DataFrame`](DataFrame.md)
11
+
doesn't implement the [`Collection`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-collection/#kotlin.collections.Collection)
12
+
or [`Iterable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/)
13
+
interface, it has many similar operations,
14
+
such as [`filter`](filter.md), [`take`](sliceRows.md#take),
15
+
[`first`](first.md), [`map`](map.md), [`groupBy`](groupBy.md) etc.
12
16
13
17
[`DataFrame`](DataFrame.md) has two-way compatibility with [`Map`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/) and [`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/):
Columns, rows and values of [`DataFrame`](DataFrame.md) can be accessed as [`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/), [`Iterable`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-iterable/) and [`Sequence`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.sequences/-sequence/) accordingly:
23
+
Columns, rows, and values of [`DataFrame`](DataFrame.md)
24
+
can be accessed as [`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/),
and [`Sequence`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.sequences/-sequence/) accordingly:
20
27
21
28
<!---FUN getRowsColumns-->
22
29
@@ -54,7 +61,8 @@ val df = list.toDataFrame()
54
61
55
62
<!---END-->
56
63
57
-
Mark original data class with [`DataSchema`](schemas.md) annotation to get [extension properties](extensionPropertiesApi.md) and perform data transformations.
64
+
Mark the original data class with [`DataSchema`](schemas.md)
65
+
annotation to get [extension properties](extensionPropertiesApi.md) and perform data transformations.
58
66
59
67
<!---FUN listInterop3-->
60
68
@@ -69,12 +77,12 @@ val df2 = df.add("c") { a + b }
69
77
70
78
<tip>
71
79
72
-
To enable extension properties generation you should use [dataframe plugin](schemasGradle.md)
73
-
for Gradle or [Kotlin jupyter kernel](installation.md)
80
+
To enable extension properties generation, you should use the [DataFrame plugin](schemasGradle.md)
81
+
for Gradle or the [Kotlin Jupyter kernel](installation.md)
74
82
75
83
</tip>
76
84
77
-
After data is transformed, [`DataFrame`](DataFrame.md) can be exported
85
+
After your data is transformed, [`DataFrame`](DataFrame.md) instances can be exported
78
86
into [`List`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/) of another data class using [toList](toList.md) or [toListOf](toList.md#tolistof) extensions:
79
87
80
88
<!---FUN listInterop4-->
@@ -87,6 +95,6 @@ val result = df2.toListOf<Output>()
87
95
88
96
<!---END-->
89
97
90
-
### Converting columns with objects instances to ColumnGroup
98
+
### Converting columns with object instances to ColumnGroup
91
99
92
100
[unfold](unfold.md) can be used as [`toDataFrame()`](createDataFrame.md#todataframe) analogue for specific columns inside existing dataframes
0 commit comments