Update the documentation of Row condition #1889
Conversation
…Filter`, move samples from `core` to `samples`
|
|
||
| ```kotlin | ||
| // Row expression computes updated values | ||
| df.update { weight }.at(1, 3, 4).with { prev()?.weight } |
There was a problem hiding this comment.
This is the original example. Do you think we should replace it with something more plausible?
Something like df.update { age }.at(1).with { it + 1 }?
There was a problem hiding this comment.
I'd expand the original one - use both prev() and it and write about it in the comment
| ```kotlin | ||
| // Row condition is used to filter rows by index | ||
| // Row filter is used to filter rows by index | ||
| df.filter { index() % 5 == 0 } |
There was a problem hiding this comment.
Also an original example. Do you think it's fine?
There was a problem hiding this comment.
I'd replace with something more meaningful — name == && age > ...
There was a problem hiding this comment.
And also, just here, I'd show the original df first with highlighted rows meeting the predicate.
| `RowValueFilter` is used via the `where` clause after selecting columns in functions | ||
| such as [`update`](update.md), [`gather`](gather.md), and [`format`](format.md). | ||
| Like `RowFilter`, it returns a `Boolean` indicating whether the row should be included in the result. | ||
| However, unlike `RowFilter`, where both `this` and `it` refer to the current [`DataRow`](DataRow.md), |
There was a problem hiding this comment.
Is it correct? As far as I understood, it's not that RowFilter works with entire rows and RowValueFilter works only with parts of rows. RowValueFilter can also access the whole row, it just additionally accesses the selected part of the row as it, right?
There was a problem hiding this comment.
RowValueFilter works only with parts of rows
Why?
There was a problem hiding this comment.
I do not think that RowValueFilter works only with parts of rows. In the second sentence I mean that as far as I understood, the distinction between RowFilter and RowValueFilter is not "one works only with entire rows and another works only with parts of rows" :)
There was a problem hiding this comment.
Sorry, missread.
So, yes, totally correct! But not sure if RowValueFilter is used only via the where.
| ``` | ||
|
|
||
| <!---END--> | ||
| <inline-frame src="resources/filter.html" width="100%"/> |
| and are used in [add](add.md), [filter](filter.md), [forEach](iterate.md), [update](update.md), and other operations. | ||
|
|
||
| <!---FUN expressions--> | ||
| Row expression signature: ```DataRow.(DataRow) -> T```. Row values can be accessed with or without ```it``` keyword. |
There was a problem hiding this comment.
But below you show and example of update.with which has a different signature (it has a s type of selected column values)!
I believe we miss here Row-Value Expression definition
Could you please review it and rewrite it the same way as Row-Value Condition.
|
|
||
| ```kotlin | ||
| // Row expression computes updated values | ||
| df.update { weight }.at(1, 3, 4).with { prev()?.weight } |
There was a problem hiding this comment.
I'd expand the original one - use both prev() and it and write about it in the comment
| ```kotlin | ||
| // Row condition is used to filter rows by index | ||
| // Row filter is used to filter rows by index | ||
| df.filter { index() % 5 == 0 } |
There was a problem hiding this comment.
I'd replace with something more meaningful — name == && age > ...
| `RowValueFilter` is used via the `where` clause after selecting columns in functions | ||
| such as [`update`](update.md), [`gather`](gather.md), and [`format`](format.md). | ||
| Like `RowFilter`, it returns a `Boolean` indicating whether the row should be included in the result. | ||
| However, unlike `RowFilter`, where both `this` and `it` refer to the current [`DataRow`](DataRow.md), |
There was a problem hiding this comment.
RowValueFilter works only with parts of rows
Why?
|
@Allex-Nik let me fix #1888 so you can make examples prettier! |

Fixes #1706
Helps #898
RowFilterandRowValueFilteras kinds of row conditionsDataRowsamples fromcoretosamples