Skip to content
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
7 changes: 3 additions & 4 deletions examples/android-example/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,12 @@ dependencies {
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)

// TODO update version
// Core Kotlin DataFrame API, JSON and CSV IO.
// See custom Gradle setup:
// https://kotlin.github.io/dataframe/setupcustomgradle.html
implementation("org.jetbrains.kotlinx:dataframe-core:1.0.0-Beta3")
implementation("org.jetbrains.kotlinx:dataframe-json:1.0.0-Beta3")
implementation("org.jetbrains.kotlinx:dataframe-csv:1.0.0-Beta3")
implementation("org.jetbrains.kotlinx:dataframe-core:1.0.0-Beta4")
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's put these in .toml as well: #1610 (can be another issue)

implementation("org.jetbrains.kotlinx:dataframe-json:1.0.0-Beta4")
implementation("org.jetbrains.kotlinx:dataframe-csv:1.0.0-Beta4")
// You can add any additional IO modules you like, except for 'dataframe-arrow'.
// Apache Arrow is not supported well on Android.
}
2 changes: 1 addition & 1 deletion examples/android-example/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
agp = "8.11.1"
kotlin = "2.2.20"
kotlin = "2.3.0-RC2"
coreKtx = "1.10.1"
junit = "4.13.2"
junitVersion = "1.1.5"
Expand Down
11 changes: 8 additions & 3 deletions examples/kotlin-dataframe-plugin-example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,26 @@ import org.jlleitschuh.gradle.ktlint.KtlintExtension
plugins {
id("org.jlleitschuh.gradle.ktlint") version "12.3.0"

val kotlinVersion = "2.2.20"
val kotlinVersion = "2.3.0-RC2"
kotlin("jvm") version kotlinVersion
// Add the Kotlin DataFrame Compiler plugin of the same version as the Kotlin plugin.
kotlin("plugin.dataframe") version kotlinVersion

application
}

group = "org.example"
version = "1.0-SNAPSHOT"

repositories {
maven("https://packages.jetbrains.team/maven/p/kt/dev/")
mavenCentral()
}

dependencies {
implementation("org.jetbrains.kotlinx:dataframe:1.0.0-Beta3")
// Add general `dataframe` dependency
implementation("org.jetbrains.kotlinx:dataframe:1.0.0-Beta4")
// Add `kandy` dependency
implementation("org.jetbrains.kotlinx:kandy-lets-plot:0.8.3")
testImplementation(kotlin("test"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,22 @@ package org.jetbrains.kotlinx.dataframe.examples.plugin
import org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.dataframe.annotations.DataSchema
import org.jetbrains.kotlinx.dataframe.api.add
import org.jetbrains.kotlinx.dataframe.api.aggregate
import org.jetbrains.kotlinx.dataframe.api.convert
import org.jetbrains.kotlinx.dataframe.api.convertTo
import org.jetbrains.kotlinx.dataframe.api.filter
import org.jetbrains.kotlinx.dataframe.api.groupBy
import org.jetbrains.kotlinx.dataframe.api.into
import org.jetbrains.kotlinx.dataframe.api.max
import org.jetbrains.kotlinx.dataframe.api.rename
import org.jetbrains.kotlinx.dataframe.api.renameToCamelCase
import org.jetbrains.kotlinx.dataframe.api.with
import org.jetbrains.kotlinx.dataframe.io.readCsv
import org.jetbrains.kotlinx.dataframe.io.writeCsv
import org.jetbrains.kotlinx.kandy.dsl.plot
import org.jetbrains.kotlinx.kandy.letsplot.export.save
import org.jetbrains.kotlinx.kandy.letsplot.feature.layout
import org.jetbrains.kotlinx.kandy.letsplot.layers.bars
import java.net.URL

// Declare data schema for the DataFrame from jetbrains_repositories.csv.
Expand Down Expand Up @@ -83,11 +90,21 @@ fun main() {
// Write the updated DataFrame to a CSV file.
reposUpdated.writeCsv("jetbrains_repositories_new.csv")

// TODO: Add Kandy Plot
// reposUpdated.groupBy { kind }.max { stargazersCount }.plot {
// bars {
// x(kind)
// y(stargazersCount)
// }
// }
reposUpdated
// Group repositories by kind
.groupBy { kind }
// And then compute the maximum stars in each group.
.aggregate {
max { stars } into "maxStars"
}
// Build a bar plot showing the maximum number of stars per repository kind.
.plot {
bars {
x(kind)
y(maxStars)
}
layout.title = "Max stars per repo kind"
}
// Save the plot to an SVG file.
.save("kindToStars.svg")
}