Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add row functions to "operations overview" to make it comprehensive #412

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/StardustDocs/d.tree
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
<toc-element topic="statisticalRelationship.md">
<toc-element topic="corr.md"/>
</toc-element>
<toc-element topic="rowStats.md"/>
</toc-element>
<toc-element topic="multipleDataFrames.md">
<toc-element topic="addDf.md"/>
Expand Down
14 changes: 12 additions & 2 deletions docs/StardustDocs/topics/DataRow.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@

## Row functions

<snippet id="rowFunctions">

* `index(): Int` — sequential row number in [`DataFrame`](DataFrame.md), starts from 0
* `prev(): DataRow?` — previous row (`null` for the first row)
* `next(): DataRow?` — next row (`null` for the last row)
* `diff(T) { rowExpression }: T / diffOrNull { rowExpression }: T?` — difference between the results of a [row expression](#row-expressions) calculated for current and previous rows
* `diff(T) { rowExpression }: T / diffOrNull { rowExpression }: T?` — difference between the results of a [row expression](DataRow.md#row-expressions) calculated for current and previous rows
* `values(): List<Any?>` — list of all cell values from the current row
* `valuesOf<T>(): List<T>` — list of values of given type
* `valuesOf<T>(): List<T>` — list of values of the given type
* `columnsCount(): Int` — number of columns
* `columnNames(): List<String>` — list of all column names
* `columnTypes(): List<KType>` — list of all column types
Expand All @@ -24,6 +26,8 @@
* `get(column): T` — cell value by this row and given `column`
* `df()` — [`DataFrame`](DataFrame.md) that current row belongs to

</snippet>

## Row expressions
Row expressions provide a value for every row of [`DataFrame`](DataFrame.md) and are used in [add](add.md), [filter](filter.md), [forEach](iterate.md), [update](update.md) and other operations.

Expand Down Expand Up @@ -66,8 +70,12 @@ df.update { weight }.where { index() > 4 && city != "Paris" }.withValue(50)

Row condition signature: ```DataRow.(DataRow) -> Boolean```



## Row statistics
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Statistics


<snippet id="rowStatistics">

The following [statistics](summaryStatistics.md) are available for `DataRow`:
* `rowMax`
* `rowMin`
Expand All @@ -85,3 +93,5 @@ To apply statistics only to values of particular type use `-Of` versions:
* `rowSumOf<T>`
* `rowMeanOf<T>`
* `rowMedianOf<T>`

</snippet>
8 changes: 8 additions & 0 deletions docs/StardustDocs/topics/operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ Most multiplex operations end with `into` or `with` function. The following nami
* `into` defines column names for storing operation results. Used in [`move`](move.md), [`group`](group.md), [`split`](split.md), [`merge`](merge.md), [`gather`](gather.md), [`groupBy`](groupBy.md), [`rename`](rename.md).
* `with` defines row-wise data transformation with [`row expression`](DataRow.md#row-expressions). Used in [`update`](update.md), [`convert`](convert.md), [`replace`](replace.md), [`pivot`](pivot.md).

## List of DataRow operations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since it's a title, probably write "Operations" with a capital. Same as for the other headers in the file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kotlin documentation and writerside documentation doesn't use title case, i think we probably shouldn't bother either? https://kotlinlang.org/docs/server-overview.html#deploying-kotlin-server-side-applications
https://kotlinlang.org/docs/constructing-collections.html

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! But then we do need to make sure to remove all title case usages in the rest of the file(s). I'll add it here


<include from="DataRow.md" element-id="rowFunctions"/>

## List of DataRow statistics

<include from="DataRow.md" element-id="rowStatistics"/>

## List of DataFrame operations

* [add](add.md) — add columns
Expand Down
3 changes: 3 additions & 0 deletions docs/StardustDocs/topics/rowStats.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Row statistics

<include from="DataRow.md" element-id="rowStatistics"/>