Dataframe 0.14 Help

unfold

Returns DataFrame in which selected data columns are converted to ColumnGroup/FrameColumn according to the values of the properties of the objects.

It's a special case of convert operation.

This operation is useful when:

  1. you use a library API that gives you class instances

  2. you do not want to or cannot annotate classes with @DataSchema

Library API

class RepositoryInfo(val data: Any) fun downloadRepositoryInfo(url: String) = RepositoryInfo("fancy response from the API")

Consider you have an existing DataFrame with some URLs, arguments for an API call.

val interestingRepos = dataFrameOf("name", "url")( "dataframe", "/dataframe", "kotlin", "/kotlin", ) val initialData = interestingRepos .add("response") { downloadRepositoryInfo("url"<String>()) }

Using unfold you can convert response to a ColumnGroup and use rich modify capabilities.

val df = initialData.unfold("response")
df.move { response.data }.toTop() df.rename { response.data }.into("description")
Last modified: 27 September 2024