Closed mwisnicki closed 3 years ago
This gets me close to what I want (although columns are ordered lexicographically rather than as defined in data class constructor) but IMHO should be default behavior:
%use krangl
someListOfDataClasses.asDataFrame()
This one will require a compiler plugin since it is not possible to decompose a generic data class (or any other class) without it. It could be done with a serialization plugin and would work for and any class marked as @Serializable
.
@mwisnicki You can achive the same thing using dataframe library. But I don't think it should be a default behaviour
@altavir in case of data classes (which we can check in RT with KClass<*>.isData
) all the constructor arguments are properties, and we can get all constructor arguments in the proper order: KClass<*>.primaryConstructor?.parameters
. Some properties that are not present in primary constructor have a chance to stay unordered but it is generally acceptable
I will close this issue. I've created the issue in dataframe about this problem: https://github.com/Kotlin/dataframe/issues/32
A list of data classes should be rendered as a table like the
DataFrame
rather than simpletoString()