KotlinNotebookPluginUtils

A class with utility methods for Kotlin Notebook Plugin integration. Kotlin Notebook Plugin acts as a client of Kotlin Jupyter kernel and uses this functionality for dynamic pagination when rendering dataframes. The plugin sends the following code to the kernel to evaluate: DISPLAY(KotlinNotebooksPluginUtils.getRowsSubsetForRendering(Out..., 0, 20), "")

Types

Link copied to clipboard
data class IdeBuildNumber(val ideName: String, val majorVersion: Int, val buildId: Int)

Functions

Link copied to clipboard
fun convertToDataFrame(dataframeLike: Any): AnyFrame

Converts dataframeLike to AnyFrame. If dataframeLike is already AnyFrame then it is returned as is. If it's not possible to convert dataframeLike to AnyFrame then IllegalArgumentException is thrown.

Link copied to clipboard
fun generateRandomVariationOfColumnName(preferredName: String, usedNames: List<String> = emptyList()): String

Generates a random variation of a column name that is unique among the provided used names.

Link copied to clipboard

Retrieves the build number of the Kotlin Notebook IDE.

Link copied to clipboard
fun getRowsSubsetForRendering(dataFrameLike: Any?, startIdx: Int, endIdx: Int): DisableRowsLimitWrapper

Returns a subset of rows from the given dataframe for rendering. It's used for example for dynamic pagination in Kotlin Notebook Plugin.

Link copied to clipboard
internal fun isDataframeConvertable(dataframeLike: Any?): Boolean
Link copied to clipboard
fun sortByColumns(dataFrameLike: Any?, columnPaths: List<List<String>>, desc: List<Boolean>): AnyFrame

Sorts a dataframe-like object by multiple columns. If a column type is not comparable, sorting by string representation is applied instead. Sorts DataFrames by their size because looking at the smallest / biggest groups after groupBy is very popular.

fun sortByColumns(df: AnyFrame, columnPaths: List<List<String>>, isDesc: List<Boolean>): AnyFrame

Sorts a dataframe by multiple columns with specified sorting order for each column. If a column type is not comparable, sorting by string representation is applied instead.