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
* Returns the first [row][DataRow] in this [DataFrame] that satisfies the given [predicate].
135
+
*
136
+
* The [predicate] is a [RowFilter][org.jetbrains.kotlinx.dataframe.RowFilter] — a lambda that receives each [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as both `this` and `it`
137
+
* and is expected to return a [Boolean] value.
138
+
*
139
+
* It allows you to define conditions using the row's values directly,
140
+
* including through [extension properties][org.jetbrains.kotlinx.dataframe.documentation.ExtensionPropertiesAPIDocs] for convenient and type-safe access.
141
+
*
142
+
* This can include [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] and nested columns.
143
+
*
144
+
* ### Example
145
+
* ```kotlin
146
+
* // In a DataFrame of financial transactions sorted by time,
147
+
* // find the first transaction with amount over 100 euros
148
+
* df.first { amount > 100 }
149
+
* ```
150
+
*
151
+
* See also [firstOrNull][DataFrame.firstOrNull],
152
+
* [last][DataFrame.last],
153
+
* [take][DataFrame.take],
154
+
* [takeWhile][DataFrame.takeWhile],
155
+
* [takeLast][DataFrame.takeLast].
156
+
*
157
+
* @param [predicate] A [row filter][RowFilter] used to get the first value
158
+
* that satisfies a condition specified in this filter.
159
+
*
160
+
* @return A [DataRow] containing the first row that matches the given [predicate].
161
+
*
162
+
* @throws [NoSuchElementException] if the [DataFrame] contains no rows matching the [predicate].
* Returns the first [row][DataRow] in this [DataFrame] that satisfies the given [predicate].
171
+
* Returns `null` if the [DataFrame] contains no rows matching the [predicate]
172
+
* (including the case when the [DataFrame] is empty).
173
+
*
174
+
* The [predicate] is a [RowFilter][org.jetbrains.kotlinx.dataframe.RowFilter] — a lambda that receives each [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as both `this` and `it`
175
+
* and is expected to return a [Boolean] value.
176
+
*
177
+
* It allows you to define conditions using the row's values directly,
178
+
* including through [extension properties][org.jetbrains.kotlinx.dataframe.documentation.ExtensionPropertiesAPIDocs] for convenient and type-safe access.
179
+
*
180
+
* This can include [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] and nested columns.
181
+
*
182
+
* ### Example
183
+
* ```kotlin
184
+
* // In a DataFrame of financial transactions sorted by time,
185
+
* // find the first transaction with amount over 100 euros,
186
+
* // or 'null' if there is no such transaction
187
+
* df.firstOrNull { amount > 100 }
188
+
* ```
189
+
*
190
+
* See also [first][DataFrame.first],
191
+
* [last][DataFrame.last],
192
+
* [take][DataFrame.take],
193
+
* [takeWhile][DataFrame.takeWhile],
194
+
* [takeLast][DataFrame.takeLast].
195
+
*
196
+
* @param [predicate] A [row filter][RowFilter] used to get the first value
197
+
* that satisfies a condition specified in this filter.
198
+
*
199
+
* @return A [DataRow] containing the first row that matches the given [predicate],
200
+
* or `null` if the [DataFrame] contains no rows matching the [predicate].
* [Reduces][GroupByDocs.Reducing] the groups of this [GroupBy]
238
+
* by taking from each group the first [row][DataRow] satisfying the given [predicate],
239
+
* and returns a [ReducedGroupBy] containing these rows (one [row][DataRow] per group,
240
+
* each [row][DataRow] is the first [row][DataRow] in its group that satisfies the [predicate]).
241
+
*
242
+
* If the group in [GroupBy] contains no matching rows,
243
+
* the corresponding row in [ReducedGroupBy] will contain `null` values for all columns in the group,
244
+
* except the grouping key.
245
+
*
246
+
* The [predicate] is a [RowFilter][org.jetbrains.kotlinx.dataframe.RowFilter] — a lambda that receives each [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as both `this` and `it`
247
+
* and is expected to return a [Boolean] value.
248
+
*
249
+
* It allows you to define conditions using the row's values directly,
250
+
* including through [extension properties][org.jetbrains.kotlinx.dataframe.documentation.ExtensionPropertiesAPIDocs] for convenient and type-safe access.
251
+
*
252
+
* This can include [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] and nested columns.
253
+
*
254
+
* ### Example
255
+
* ```kotlin
256
+
* // In a DataFrame of orders sorted by date and time,
257
+
* // find the first order over 100 euros placed by each customer
258
+
* df.groupBy { customerId }.first { total > 100 }.concat()
259
+
* ```
260
+
*
261
+
* See also [last][GroupBy.last].
262
+
*
263
+
* @param [predicate] A [row filter][RowFilter] used to get the first value
264
+
* that satisfies a condition specified in this filter.
265
+
*
266
+
* @return A [ReducedGroupBy] containing the first [row][DataRow] matching the [predicate]
267
+
* (or a [row][DataRow] with `null` values, except the grouping key) from each group.
* [Reduces][PivotDocs.Reducing] this [Pivot] by taking from each group the first [row][DataRow]
297
+
* satisfying the given [predicate], and returns a [ReducedPivot] that contains the first row, matching the [predicate],
298
+
* from the corresponding group in each column.
299
+
*
300
+
* For more information about [Pivot] with examples: [See `pivot` on the documentation website.](https://kotlin.github.io/dataframe/pivot.html)
301
+
*
302
+
* The [predicate] is a [RowFilter][org.jetbrains.kotlinx.dataframe.RowFilter] — a lambda that receives each [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as both `this` and `it`
303
+
* and is expected to return a [Boolean] value.
304
+
*
305
+
* It allows you to define conditions using the row's values directly,
306
+
* including through [extension properties][org.jetbrains.kotlinx.dataframe.documentation.ExtensionPropertiesAPIDocs] for convenient and type-safe access.
307
+
*
308
+
* This can include [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] and nested columns.
309
+
*
310
+
* ### Example
311
+
* ```kotlin
312
+
* // In a DataFrame of real estate listings sorted by price,
313
+
* // find the cheapest listing for each type of property (house, apartment, etc.)
314
+
* // with is not yet sold out.
315
+
* df.pivot { type }.first { !soldOut }.values()
316
+
* ```
317
+
*
318
+
* See also [pivot], [reduce][Pivot.reduce], [last][Pivot.last].
319
+
*
320
+
* @param [predicate] A [row filter][RowFilter] used to get the first value
321
+
* that satisfies a condition specified in this filter.
322
+
*
323
+
* @return A [ReducedPivot] containing in each column the first [row][DataRow]
324
+
* that satisfies the [predicate], from the corresponding group (or a [row][DataRow] with `null` values).
* [Reduces][PivotGroupByDocs.Reducing] this [PivotGroupBy] by taking the first [row][DataRow]
334
+
* from each combined [pivot] + [groupBy] group, and returns a [ReducedPivotGroupBy]
335
+
* that contains the first row from each corresponding group.
336
+
* If any combined [pivot] + [groupBy] group in [PivotGroupBy] is empty, in the resulting [ReducedPivotGroupBy]
337
+
* it will be represented by a [row][DataRow] with `null` values (except the grouping key).
338
+
*
339
+
* For more information about [PivotGroupBy] with examples: [See "`pivot` + `groupBy`" on the documentation website.](https://kotlin.github.io/dataframe/pivot.html#pivot-groupby)
340
+
*
341
+
* ### Example
342
+
* ```kotlin
343
+
* // In a DataFrame of real estate listings sorted by price,
344
+
* // find the cheapest listing for each combination of type of property (house, apartment, etc.)
345
+
* // and the city it is located in
346
+
* df.pivot { type }.groupBy { city }.first().values()
347
+
* ```
348
+
*
349
+
* See also [groupBy][Pivot.groupBy],
350
+
* [pivot][GroupBy.pivot],
351
+
* [reduce][PivotGroupBy.reduce],
352
+
* [last][PivotGroupBy.last].
353
+
*
354
+
* @return A [ReducedPivotGroupBy] containing in each combination of a [groupBy] key and a [pivot] key either
355
+
* the first [row][DataRow] of the corresponding [DataFrame] formed by this pivot–group pair,
356
+
* or a [row][DataRow] with `null` values (except the grouping key) if this [DataFrame] is empty.
* [Reduces][PivotGroupByDocs.Reducing] this [PivotGroupBy]
362
+
* by taking from each combined [pivot] + [groupBy] group the first [row][DataRow] satisfying the given [predicate].
363
+
* Returns a [ReducedPivotGroupBy] that contains the first row, matching the [predicate], from each corresponding group.
364
+
* If any combined [pivot] + [groupBy] group in [PivotGroupBy] does not contain any rows matching the [predicate],
365
+
* in the resulting [ReducedPivotGroupBy] it will be represented by a [row][DataRow] with `null` values
366
+
* (except the grouping key).
367
+
*
368
+
* [See "`pivot` + `groupBy`" on the documentation website.](https://kotlin.github.io/dataframe/pivot.html#pivot-groupby)
369
+
*
370
+
* [See `pivot` on the documentation website.](https://kotlin.github.io/dataframe/pivot.html)
371
+
*
372
+
* [See `groupBy` on the documentation website.](https://kotlin.github.io/dataframe/groupby.html)
373
+
*
374
+
* The [predicate] is a [RowFilter][org.jetbrains.kotlinx.dataframe.RowFilter] — a lambda that receives each [DataRow][org.jetbrains.kotlinx.dataframe.DataRow] as both `this` and `it`
375
+
* and is expected to return a [Boolean] value.
376
+
*
377
+
* It allows you to define conditions using the row's values directly,
378
+
* including through [extension properties][org.jetbrains.kotlinx.dataframe.documentation.ExtensionPropertiesAPIDocs] for convenient and type-safe access.
379
+
*
380
+
* This can include [column groups][org.jetbrains.kotlinx.dataframe.columns.ColumnGroup] and nested columns.
381
+
*
382
+
* ### Example
383
+
* ```kotlin
384
+
* // In a DataFrame of real estate listings sorted by price,
385
+
* // for each combination of type of property (house, apartment, etc.)
386
+
* // and the city it is located in,
387
+
* // find the cheapest listing that is not yet sold out
388
+
* df.pivot { type }.groupBy { city }.first { !soldOut }.values()
389
+
* ```
390
+
*
391
+
* See also [groupBy][Pivot.groupBy],
392
+
* [pivot][GroupBy.pivot],
393
+
* [reduce][PivotGroupBy.reduce],
394
+
* [last][PivotGroupBy.last].
395
+
*
396
+
* @param [predicate] A [row filter][RowFilter] used to get the first value
397
+
* that satisfies a condition specified in this filter.
398
+
*
399
+
* @return A [ReducedPivotGroupBy] containing in each combination of a [groupBy] key and a [pivot] key either
400
+
* the first matching the [predicate] [row][DataRow] of the corresponding [DataFrame] formed by this pivot–group pair,
401
+
* or a [row][DataRow] with `null` values if this [DataFrame] does not contain any rows matching the [predicate].
0 commit comments