Skip to content

Conversation

@koperagen
Copy link
Collaborator

Replaced some examples that don't work with compiler plugin and use outdated API that we plan to replace, with toDataFrame operation.
Now examples with random data can be copy-pasted into project with compiler plugin. Plus, generally it's much more powerful approach that can produce sophisticated dataframes:

image image

In the process i found that our rendering doesn't work for some of the examples and fixed it.
image

image

@koperagen koperagen added this to the 1.0.0-Beta4 milestone Oct 23, 2025
@koperagen koperagen self-assigned this Oct 23, 2025
@koperagen koperagen added the documentation Improvements or additions to documentation (not KDocs) label Oct 23, 2025
@koperagen koperagen force-pushed the plugin-friendly-examples-update branch from d836c6e to 0a65d11 Compare October 23, 2025 13:46
@koperagen koperagen force-pushed the plugin-friendly-examples-update branch from 0a65d11 to 8861f89 Compare October 23, 2025 14:03
@koperagen koperagen force-pushed the plugin-friendly-examples-update branch from 8861f89 to b51f36a Compare October 23, 2025 15:56
@Jolanrensen Jolanrensen self-requested a review October 27, 2025 13:50
Copy link
Collaborator

@Jolanrensen Jolanrensen left a comment

Choose a reason for hiding this comment

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

Nice! It really shows off the power of toDataFrame() :)

// SampleStart
val categories = listOf("Electronics", "Books", "Clothing")
// DataFrame with 4 columns and 7 rows
(0 until 7).toDataFrame {
Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe nice to show off ..< instead of until :) but up to you

"reviews" from {
val reviewCount = Random.nextInt(0, 8)
(0 until reviewCount).toDataFrame {
val ratings: DataColumn<Int> = expr { Random.nextInt(1, 6) }
Copy link
Collaborator

Choose a reason for hiding this comment

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

could you use the Kotlin Random extension functions which take ranges instead? :) With those it's immediately clear which number is included and which is not Random.nextInt(1..5), whereas with Random.nextInt(1, 6) I'd have to know 6 is excluded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation (not KDocs)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants