Lubomir Pisk
10/29/2024, 8:09 PMplugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlinx.dataframe)
}
kotlin {
jvm {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
sourceSets {
jvmMain {
dependencies {
implementation(project(":core:config"))
implementation(project(":core:datetime"))
implementation(project(":core:di"))
implementation(project(":core:format"))
implementation(project(":core:graph"))
implementation(libs.koin.core)
implementation(libs.kotlinx.coroutines)
implementation(libs.kotlinx.dataframe)
implementation(libs.kotlinx.datetime)
}
}
}
}
kotlinx-dataframe = { id = "org.jetbrains.kotlinx.dataframe", version.ref = "dataframe" }
kotlinx-dataframe = { group = "org.jetbrains.kotlinx", name = "dataframe", version.ref = "dataframe" }
holgerbrandl
11/08/2024, 5:08 AMSinan Gunes
11/19/2024, 2:25 PMdataFrame
project. I would like to use custom enums, as property read from CSV. Is there a way to do it?
Thanks 👍holgerbrandl
11/27/2024, 3:01 PMzaleslaw
12/11/2024, 10:08 AMzaleslaw
12/17/2024, 11:48 AM0.8.0-RC1
.
The detailed documentation and user guide are on their way, but for now, you can refer to the attached notebook,
which includes examples, use cases, and demonstrations of working with geospatial data.
We’d love to hear your feedback and impressions as you try out this new functionality!
https://gist.github.com/AndreiKingsley/5aa25acbfa52aadbb6a3e3c641c54d57shaktiman_droid
12/20/2024, 9:56 PMaltavir
12/25/2024, 6:03 AMJens
01/09/2025, 9:50 AMesionecneics
01/09/2025, 11:50 PMimport org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.kandy.dsl.plot
import org.jetbrains.kotlinx.kandy.letsplot.layers.line
import org.jetbrains.kotlinx.kandy.util.color.Color
fun visualizeCustomerNumber(df: DataFrame<*>) {
df.plot {
line {
x("createdAt") {
axis {
name = "Date"
}
}
y("customerNumber") {
axis {
name = "Customer Number"
}
}
color = Color.RED
}
layout {
title = "Tomorrow Customer Number"
}
}
}
The keywords: |axis, name, layout, title| are recognized by IntelliJ
The import in the notebook on the other hand works perfectly with: %use kandy
This is the version I use in my build.gradle.kts:
dependencies {
implementation("org.jetbrains.kotlinxkandy lets plot0.8.0-RC1")
}Dumitru Preguza
01/22/2025, 4:14 PMlistOf(jobRepository.getJobById(12345)).toDataFrame()
The problem is found in one of the loaded libraries: check library renderers
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: data.entity.JobDefinition.jobRuns: could not initialize proxy - no Session
org.jetbrains.kotlinx.jupyter.exceptions.ReplLibraryException: The problem is found in one of the loaded libraries: check library renderers
at ...
Dumitru Preguza
01/22/2025, 4:39 PM$$"test $test"
$$"""test $test"""
Exception/hint appears:
The feature "multi dollar interpolation" is experimental and should be enabled explicitlypatrickdelconte
02/14/2025, 7:05 PMscale
and axis
inside y()
without any luck, none of it worked. It seems like only the last usage of scale
makes it into the plot.
val wounds = listOf(4520, 3242, 3128, 3156, 4115, 5082, 5918, 3811, 5013, 6426, 5952, 5761, 5685, 5316, 4726, 4127, 4121, 3837, 3232, 2684, 2151, 1904, 1528, 1182, 971, 679, 564, 367, 276, 194, 111, 87, 59, 42, 19, 11, 1, 2)
val betterPercent = wounds.indices.map { x -> (wounds.filterIndexed { index, _ -> index > x }.sumOf { it } / wounds.sum().toDouble() * 100.0).roundToInt() }
plot() {
x(wounds.indices)
bars() {
y(wounds)
}
line {
y(betterPercent){
scale = continuous(0..100)
}
}
}
zaleslaw
02/19/2025, 2:51 PMJens
03/03/2025, 5:51 PM[2025-03-03T17:49:09.967Z] Caused by: java.io.IOException: Zip bomb detected! The file would exceed the max. ratio of compressed file size to the size of the expanded data.
[2025-03-03T17:49:09.967Z] This may indicate that the file is used to inflate memory usage and thus could pose a security risk.
[2025-03-03T17:49:09.967Z] You can adjust this limit via ZipSecureFile.setMinInflateRatio() if you need to work with files which exceed this limit.
[2025-03-03T17:49:09.967Z] Uncompressed size: 847128, Raw/compressed size: 8468, ratio: 0.009996
I have the following deps in my build.gradle.kts, but the class ZipSecureFile can't be found. Is there another way, I can set the min inflate ratio?
implementation("org.jetbrains.kotlinx:dataframe:0.15.0")
implementation("org.jetbrains.kotlinx:dataframe-excel:0.15.0")
Jens
03/03/2025, 5:54 PM%use dataframe
Seems to add this class to the classpath and it can be imported. What's the corresponding dependency, when working with dataframe in headless production code?Jens
03/03/2025, 6:00 PMimplementation ("org.apache.poi:poi-ooxml:5.2.3")
Paulina Sobieszuk
03/06/2025, 12:34 PMWhat do you use DataFrame for?
1️⃣ Generating reports & dashboards
2️⃣ Preparing data for ML/AI models
3️⃣ Data cleaning & enrichment
4️⃣ Working with REST APIs, files, and SQL databases
5️⃣ Processing data in business logic applications
6️⃣ Something else (tell us in the comments)Thanks a lot for your help!
zaleslaw
03/07/2025, 2:44 PMesionecneics
03/12/2025, 1:46 PMPaulina Sobieszuk
03/13/2025, 2:34 PMMarian Schubert
03/27/2025, 1:51 PMClass '...' was compiled with an incompatible version of Kotlin. The actual metadata version is 2.1.0, but the compiler version 1.9.0 can read versions up to 2.0.0.
It seems that Kotlin notebook plugin is using Kotlin 1.9 compiler? Is there any way to fix that problem?eenriquelopez
04/08/2025, 2:13 PM// Simulation parameters
val years = 30
val simulations = 10000
val initialInvestment = 1.0
// Market probabilities (adjusting bear probability to 30% and bull to 70%)
val bullProb = 0.75 // 75% for Bull markets
// Portfolio returns
val portfolioA = mapOf("bull" to 1.20, "bear" to 0.80)
val portfolioB = mapOf("bull" to 1.25, "bear" to 0.65)
// Function to simulate one portfolio run and return the accumulated return for each year
fun simulatePortfolioAccumulatedReturns(returns: Map<String, Double>, rng: Random): List<Double> {
var value = initialInvestment
val accumulatedReturns = mutableListOf<Double>()
repeat(years) {
val isBull = rng.nextDouble() < bullProb
val market = if (isBull) "bull" else "bear"
value *= returns[market]!!
// Calculate accumulated return for the current year
val accumulatedReturn = (value - initialInvestment) / initialInvestment * 100
accumulatedReturns.add(accumulatedReturn)
}
return accumulatedReturns
}
// Running simulations and storing accumulated returns for each year (for each portfolio)
val rng = Random(System.currentTimeMillis())
val accumulatedResults = (1..simulations).map {
val accumulatedReturnsA = simulatePortfolioAccumulatedReturns(portfolioA, rng)
val accumulatedReturnsB = simulatePortfolioAccumulatedReturns(portfolioB, rng)
mapOf("Simulation" to it, "PortfolioA" to accumulatedReturnsA, "PortfolioB" to accumulatedReturnsB)
}
// Count the number of simulations where Portfolio A outperforms Portfolio B and vice versa
var portfolioAOutperformsB = 0
var portfolioBOutperformsA = 0
accumulatedResults.forEach { result ->
val accumulatedA = result["PortfolioA"] as List<Double>
val accumulatedB = result["PortfolioB"] as List<Double>
if (accumulatedA.last() > accumulatedB.last()) {
portfolioAOutperformsB++
} else {
portfolioBOutperformsA++
}
}
// Print the results
println("Number of simulations where Portfolio A outperforms Portfolio B: $portfolioAOutperformsB")
println("Number of simulations where Portfolio B outperforms Portfolio A: $portfolioBOutperformsA")
println("Portfolio A outperformed Portfolio B in ${portfolioAOutperformsB.toDouble() / simulations * 100}% of simulations.")
println("Portfolio B outperformed Portfolio A in ${portfolioBOutperformsA.toDouble() / simulations * 100}% of simulations.")
Paulo Cereda
04/11/2025, 5:27 PM.csv
file in which one the columns has a comma-separated string. I would like to split it and have the line replicated for each element. I have a working code, but it's far from optimal. Code in thread. 🧵Jason Zhao
04/14/2025, 6:57 AMkotlinx.serialization
in the kotlin notebook? I have a notebook that needs to load my application transiently to perform a task. The application loading fails with the following error when it gets to the config deserialization part.
I initially thought it was an issue with version conflict with dependencies, but I excluded the dependencies in question from loading Kotlin Serialization and it is still occurring. Note that when I run the same application logic in a regular Kotlin main function, I don't get this error.
java.lang.AbstractMethodError: Receiver class ((my class name))$$serializer does not define or inherit an implementation of the resolved method 'abstract kotlinx.serialization.KSerializer[] typeParametersSerializers()' of interface kotlinx.serialization.internal.GeneratedSerializer.
Note: I am in K2 mode so the issue might be related to that. (On a side note variables are still not detected across cells in the K2 mode.)Ume Channel
04/29/2025, 11:13 PMUme Channel
04/30/2025, 12:55 AMUme Channel
04/30/2025, 10:35 PMUme Channel
05/01/2025, 6:21 PMKarthick
05/08/2025, 8:58 AM