Kotlin / dataframe

Structured data processing in Kotlin
https://kotlin.github.io/dataframe/overview.html
Apache License 2.0
784 stars 50 forks source link

Handling of `Number` types can be unexpected #557

Open Jolanrensen opened 6 months ago

Jolanrensen commented 6 months ago

Currently, numbers are inferred similar to type inference in Kotlin.

For instance:

DataFrame.readJsonStr("""[ { "a": 1 }, { "a": 1.0 } ]""")

results in a column: a: Number. This can cause issues with statistics like std, as they don't support Numbers as of now: https://github.com/Kotlin/dataframe/issues/558 It might be easier to work with if numbers would converge in the closest common ancestor in terms of information. For instance: Int + Double + Float => Float, since Floats can store all information a Double and Int holds.

This would need to be carefully considered, however, as it's inconsistent with Kotlin's type inference.