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
* Creates new column using row [expression] and adds it to the end of [DataFrame]
125
+
* Creates a new column using an [AddExpression] and
126
+
* adds a new column to the end of this [DataFrame] (at the top level).
127
+
*
128
+
* With an [AddExpression][org.jetbrains.kotlinx.dataframe.api.AddExpression], you define the value that each row in the new column should have.
129
+
* This can be based on values from the same row in the original [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame].
130
+
*
131
+
* You can also use functions like [prev][org.jetbrains.kotlinx.dataframe.api.prev] and [next][org.jetbrains.kotlinx.dataframe.api.next] to access other rows, and combine them with
132
+
* [newValue][org.jetbrains.kotlinx.dataframe.api.AddDataRow.newValue] to reference values already computed in the new column.
133
+
* For example, use `prev().newValue()` to access the new column value from the previous row.
134
+
*
135
+
* Returns a new [DataFrame] with the new column appended to the original list of [DataFrame.columns].
136
+
*
137
+
* ## Example
138
+
*
139
+
* ```kotlin
140
+
* // Add a new column "sum" that contains the sum of values from the "firstValue"
141
+
* // and "secondValue" columns for each row.
142
+
* val dfWithSum = df.add("sum") { firstValue + secondValue }
143
+
*
144
+
* // Add a "fibonacci" column with the Fibonacci sequence:
145
+
* // for the first two rows, the value is 1;
146
+
* // for subsequent rows, it's the sum of the two previous Fibonacci values.
* Creates a new column using [AddExpression] and inserts it at the specified [ColumnPath].
191
+
*
192
+
* With an [AddExpression][org.jetbrains.kotlinx.dataframe.api.AddExpression], you define the value that each row in the new column should have.
193
+
* This can be based on values from the same row in the original [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame].
194
+
*
195
+
* You can also use functions like [prev][org.jetbrains.kotlinx.dataframe.api.prev] and [next][org.jetbrains.kotlinx.dataframe.api.next] to access other rows, and combine them with
196
+
* [newValue][org.jetbrains.kotlinx.dataframe.api.AddDataRow.newValue] to reference values already computed in the new column.
197
+
* For example, use `prev().newValue()` to access the new column value from the previous row.
198
+
*
199
+
* For more information: [See `add` on the documentation website.](https://kotlin.github.io/dataframe/add.html).
200
+
*
201
+
* Returns a new [DataFrame] with the new column inserted at the given [path].
202
+
* If the specified path is partially or fully missing — that is, if any segment of the path
203
+
* does not correspond to an existing column or column group — all missing parts will be created automatically.
204
+
*
205
+
* ## Example
206
+
*
207
+
* ```kotlin
208
+
* // Add a new column "sum" inside the "info" column group (which will be created if it doesn't exist).
209
+
* // The column contains the sum of values from the "firstValue" and "secondValue" columns for each row.
* adds a new column to the end of each group (i.e., [DataFrame]s) of this [GroupBy] (at the top level).
379
+
*
380
+
* With an [AddExpression][org.jetbrains.kotlinx.dataframe.api.AddExpression], you define the value that each row in the new column should have.
381
+
* This can be based on values from the same row in the original [DataFrame][org.jetbrains.kotlinx.dataframe.DataFrame].
382
+
*
383
+
* You can also use functions like [prev][org.jetbrains.kotlinx.dataframe.api.prev] and [next][org.jetbrains.kotlinx.dataframe.api.next] to access other rows, and combine them with
384
+
* [newValue][org.jetbrains.kotlinx.dataframe.api.AddDataRow.newValue] to reference values already computed in the new column.
385
+
* For example, use `prev().newValue()` to access the new column value from the previous row.
386
+
*
387
+
* Returns a new [GroupBy] with the new column
388
+
* appended to each group [DataFrame] to the original list of [DataFrame.columns].
389
+
*
390
+
* ## Example
391
+
*
392
+
* ```kotlin
393
+
* // Add a new column "sum" that contains the sum of values from the "firstValue"
394
+
* // and "secondValue" columns for each row.
395
+
* val gbWithSum = gb.add("sum") { firstValue + secondValue }
396
+
*
397
+
* // Add a "fibonacci" column with the Fibonacci sequence:
398
+
* // for the first two rows, the value is 1;
399
+
* // for subsequent rows, it's the sum of the two previous Fibonacci values.
0 commit comments