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 AMPaulo Cereda
05/30/2025, 3:49 PMfun ResultSet.asSequence(): Sequence<ResultSet> = sequence {
while (next()) {
yield(this@asSequence)
}
}
operator fun ResultSet.get(index: Int): Any? = this.getObject(index)
fun ResultSet.toDataFrame(): DataFrame<*> =
mutableMapOf<String, MutableList<Any?>>()
.let { map ->
val names = List(metaData.columnCount) {
metaData.getColumnName(it + 1)
}
this
.asSequence()
.forEach { row ->
names.mapIndexed { index, name ->
map[name]?.add(row[index + 1]) ?: map.put(name, mutableListOf(row[index + 1]))
}
}
map
}.toDataFrame()
Hope someone can make use of this (even as a counterexample). 😁 Cheerio!eenriquelopez
06/18/2025, 9:52 AMeenriquelopez
06/18/2025, 9:53 AMeenriquelopez
06/18/2025, 10:53 AMUme Channel
07/15/2025, 10:32 AMDumitru Preguza
09/17/2025, 8:54 AMMarian Schubert
09/17/2025, 3:47 PMval df = dataFrameOf("id", "props")(
1, mapOf("a" to 10, "b" to 20),
2, mapOf("a" to 30, "b" to 40),
)
is it possible to convert this to dataframe with columns id, a, b?Jolan Rensen [JB]
09/18/2025, 12:34 PMrnett
09/25/2025, 8:43 PMhistogram and statBin functions mentioned in the docs do not seem to exist in the 0.8.0 version. I'm using org.jetbrains.kotlinx:kandy-lets-plot:0.8.0, what am I missing? I'm not using DataFrame, just trying to do something like thiszaleslaw
10/13/2025, 3:15 PMcorneil
10/15/2025, 8:37 AMgeoMap {
text {
label(stateProvinceName)
alpha = 1.0
x(centerX)
y(centerY)
font.color = Color.BLACK
font.size = 12.0
font.family = FontFamily.SANS
}
}
The map areas are different colours but black should be very visible. I also tried a range of sizes from 0.1 to 16.0 stateProvinceName is a column accessor and the relevant column does show up in save html or json but no label is rendered.andyg
10/24/2025, 3:35 AMcorneil
10/25/2025, 10:21 AMjava.lang.NullPointerException: null
at org.jetbrains.letsPlot.core.plot.base.aes.AesScaling.strokeWidth(AesScaling.kt:18)
at org.jetbrains.letsPlot.core.plot.base.geom.util.LinesHelper$decorate$1.invoke(LinesHelper.kt:228)
at org.jetbrains.letsPlot.core.plot.base.geom.util.LinesHelper$decorate$1.invoke(LinesHelper.kt:228)
at org.jetbrains.letsPlot.core.plot.base.geom.util.LinesHelper.decorate(LinesHelper.kt:241)
at org.jetbrains.letsPlot.core.plot.base.geom.util.LinesHelper.decorate$default(LinesHelper.kt:224)
at org.jetbrains.letsPlot.core.plot.base.geom.util.LinesHelper.createPolygon(LinesHelper.kt:112)
at org.jetbrains.letsPlot.core.plot.base.geom.PolygonGeom.buildIntern(PolygonGeom.kt:33)
at org.jetbrains.letsPlot.core.plot.base.geom.GeomBase.build(GeomBase.kt:33)