Skip to content

Website docs kotlin notebook #1180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 14, 2025
12 changes: 12 additions & 0 deletions docs/StardustDocs/cfg/platforms.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<platforms>
<platform id="primary">
<src>keymap.xml</src>
<use-keymaps>
primary_macOS
</use-keymaps>
<use-keymaps>
primary_Win-Linux
</use-keymaps>
</platform>
</platforms>
7 changes: 3 additions & 4 deletions docs/StardustDocs/d.tree
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<toc-element topic="Home.topic"/>
<toc-element topic="Guides-And-Examples.md">
<toc-element topic="quickstart.md"/>
<toc-element topic="Kotlin-DataFrame-Features-in-Kotlin-Notebook.md">
<toc-element topic="Trobleshooting.md"/>
</toc-element>
</toc-element>

<toc-element topic="gettingStarted.md" accepts-web-file-names="installation.html">
Expand Down Expand Up @@ -193,10 +196,6 @@
</toc-element>
</toc-element>
<toc-element topic="gradleReference.md"/>
<toc-element topic="Usage-with-Kotlin-Notebook-Plugin.md">
<toc-element topic="Trobleshooting.md"/>
</toc-element>
<toc-element href="https://github.com/Kotlin/dataframe/tree/master/examples" toc-title="Examples"/>
<toc-element topic="Compiler-Plugin.md"/>
<toc-element topic="_shadow_resources.md" hidden="true"/>
<toc-element topic="_shadow_resources_snippets.md" hidden="true"/>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/StardustDocs/images/ktnb_drag_n_drop.mp4
Binary file not shown.
13 changes: 13 additions & 0 deletions docs/StardustDocs/keymap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Keymap id="instance_id">
<Action id="$Settings">
<Description>Settings of Intellij IDEA</Description>
<Shortcut layout="primary_macOS">Cmd+comma</Shortcut>
<Shortcut layout="primary_Win-Linux">Ctrl+Alt+S</Shortcut>
</Action>
<Action id="$NewFile">
<Description>Settings of Intellij IDEA</Description>
<Shortcut layout="primary_macOS">Cmd+N</Shortcut>
<Shortcut layout="primary_Win-Linux">Alt+Insert</Shortcut>
</Action>
</Keymap>
4 changes: 2 additions & 2 deletions docs/StardustDocs/topics/Home.topic
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

<primary>
<title>First steps</title>
<a href="gettingStarted.md"/>
<a href="gettingStartedKotlinNotebook.md"/>
<a href="overview.md"/>
<a href="operations.md"/>
</primary>

<secondary>
<title>Featured topics</title>
<a href="Usage-with-Kotlin-Notebook-Plugin.md"/>
<a href="Kotlin-DataFrame-Features-in-Kotlin-Notebook.md"/>
</secondary>


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Get started with Kotlin DataFrame in Kotlin Notebook

<web-summary>
Use Kotlin DataFrame directly in Kotlin Notebook — write code, explore results, and refine your analysis step by step in a live environment.
</web-summary>

<card-summary>
Start analyzing data with Kotlin DataFrame in Kotlin Notebook — live code execution,
rich tables, and zero configuration required.
</card-summary>

<link-summary>
Follow a step-by-step introduction to Kotlin DataFrame in Kotlin Notebook: setup, first DataFrame, and interactive output — all in one place.
</link-summary>


[Kotlin Notebook](https://kotlinlang.org/docs/kotlin-notebook-overview.html) is an interactive environment
integrated into [IntelliJ IDEA](https://www.jetbrains.com/idea/), designed for fast, iterative,
and visual data exploration with Kotlin.

The Kotlin Notebook plugin transforms IntelliJ IDEA into a powerful data science workspace,
combining Kotlin’s strong language features with live code execution,
interactive data exploration, and rich visualizations

It’s perfect for working with Kotlin DataFrame — letting you write code, view results instantly,
and refine your analysis step by step.


## Create Kotlin Notebook

<tip>
Before version 2025.1, Kotlin Notebook is unavailable in IntelliJ IDEA Community Edition
and not bundled in IntelliJ IDEA Ultimate Edition by default.
</tip>

* Make sure the [Kotlin Notebook plugin is enabled](https://kotlinlang.org/docs/kotlin-notebook-set-up-env.html).

* Open an IntelliJ IDEA project (either new or existing).

* In the project view, create a new Kotlin Notebook file:
Press <shortcut key="$NewFile"/> or right-click the project tree, then select
<ui-path>Kotlin Notebook</ui-path>.

![Create Kotlin Notebook file](new_ktn_file.png){width="200"}

For more details, see
[Get started with Kotlin Notebook](https://kotlinlang.org/docs/get-started-with-kotlin-notebooks.html)
on the official [Kotlin Documentation](https://kotlinlang.org/docs/home.html) website.

## Integrate Kotlin DataFrame

In the new notebook file, execute the following cell to add the Kotlin DataFrame library:

```
%use dataframe
```

This will load all necessary dependencies, add required imports, and enable rich DataFrame rendering in the notebook.

### Specify a version

By default, if no version is specified, the version bundled with the notebook kernel is used.
You can explicitly define the version you want:


```
%use dataframe(1.0.0)
```

Or use the latest stable version of Kotlin DataFrame
(specified in [Kotlin Jupyter descriptors](https://github.com/Kotlin/kotlin-jupyter-libraries)):


```
%useLatestDescriptors
%use dataframe
```

## Hello World

Let’s create your first Kotlin DataFrame in the notebook — a simple "Hello, World!" style example:

```kotlin
val df = dataFrameOf(
"name" to listOf("Alice", "Bob"),
"age" to listOf(25, 30)
)
```

To display it, run a cell with the `DataFrame` variable in the last line (or simply a cell containing the variable):

```kotlin
df
```

You will see the content of this `DataFrame` rendered as an interactive table directly in the cell output:

![df_output](df_output.png) {height="168"}

## Next Steps

* Once you’ve successfully set up Kotlin DataFrame in Kotlin Notebook,
you can move on to the [](quickstart.md)
which walks you through the basics of working with DataFrames inside a notebook.

* For more advanced use cases, explore our collection of
[detailed guides and real-world examples](Guides-And-Examples.md),
showcasing how Kotlin DataFrame can help with a variety of data tasks.

* Discover powerful [](Kotlin-DataFrame-Features-in-Kotlin-Notebook.md)that
make exploring and understanding your data easier and more effective.
4 changes: 0 additions & 4 deletions docs/StardustDocs/topics/gettingStartedKotlinNotebook.md

This file was deleted.

61 changes: 57 additions & 4 deletions docs/StardustDocs/topics/guides/Guides-And-Examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,75 @@ Browse a collection of guides and examples covering key features and real-world
</web-summary>

<card-summary>
Explore Kotlin DataFrame with user guides and real-world examples,
Explore Kotlin DataFrame with detailed user guides and real-world examples,
showcasing practical use cases and data workflows.
</card-summary>

<link-summary>
A curated list of Kotlin DataFrame guides and examples that walk you through common operations and data analysis patterns step by step.
</link-summary>

<!--- TODO: add more guides (migration from pandas and others) and replace GH notebooks with topics --->

## Guides

* [Quickstart Guide](quickstart.md) — get started with Kotlin DataFrame in a few simple steps:
Explore our structured, in-depth guides to steadily improve your Kotlin DataFrame skills — step by step.

* [](quickstart.md) — get started with Kotlin DataFrame in a few simple steps:
load data, transform it, and visualize it.
* [Enhanced Column Selection DSL](https://blog.jetbrains.com/kotlin/2024/07/enhanced-column-selection-dsl-in-kotlin-dataframe/)
— explore powerful DSL for typesafe and flexible column selection in Kotlin DataFrame.
* [](Kotlin-DataFrame-Features-in-Kotlin-Notebook.md)
— discover interactive Kotlin DataFrame outputs in
[Kotlin Notebook](https://kotlinlang.org/docs/kotlin-notebook-overview.html).
* [40 Puzzles](https://github.com/Kotlin/dataframe/blob/master/examples/notebooks/puzzles/40%20puzzles.ipynb)
— inspired by [100 pandas puzzles](https://github.com/ajcr/100-pandas-puzzles).
An interactive guide that takes you from simple tasks to complex challenges,
teaching you how to solve them using Kotlin DataFrame in a concise and elegant style.
* [SQL Databases Interaction](readSqlDatabases.md)
— set up SQL database access and read query results efficiently into `DataFrame`.
* [GeoDataFrame Guide](https://kotlin.github.io/kandy/geo-plotting-guide.html)
— explore the GeoDataFrame module that brings a convenient Kotlin DataFrame API to geospatial workflows,
enhanced with beautiful Kandy-Geo visualizations (*experimental*).
* [OpenAPI Guide](https://github.com/Kotlin/dataframe/blob/master/examples/notebooks/json/KeyValueAndOpenApi.ipynb)
— learn how to parse and explore [OpenAPI](https://swagger.io) JSON structures using Kotlin DataFrame,
enabling structured access and intuitive analysis of complex API schemas (*experimental*).

<!--- TODO: add more guides. --->

## Examples

* [Titanic](titanic.md) —
Explore our extensive collection of practical examples and real-world analytics workflows.

* [Titanic Example](https://github.com/Kotlin/dataframe/blob/master/examples/notebooks/titanic/Titanic.ipynb)
— discover the famous "Titanic"
dataset with Kotlin DataFrame analysis toolkit
and [Kandy](https://kotlin.github.io/kandy/) visualizations.

* [Track and Analyze GitHub Star Growth](https://blog.jetbrains.com/kotlin/2024/08/track-and-analyze-github-star-growth-with-kandy-and-kotlin-dataframe/)
— query GitHub’s API with the Kotlin Notebook Ktor client,
then analyze and visualize the data using Kotlin DataFrame and [Kandy](https://kotlin.github.io/kandy/).

* [GitHub Example](https://github.com/Kotlin/dataframe/blob/master/examples/notebooks/github/github.ipynb)
— a practical example of working with deeply nested, hierarchical DataFrames using GitHub data.

* [Netflix Example](https://github.com/Kotlin/dataframe/blob/master/examples/notebooks/netflix/netflix.ipynb)
— explore TV shows and movies from Netflix with the powerful Kotlin Dataframe API and beautiful
[Kandy](https://kotlin.github.io/kandy/) visualizations.

* [Top-12 German Companies Financial Analyze](https://github.com/Kotlin/dataframe/blob/master/examples/notebooks/top_12_german_companies)
— analyze key financial metrics for several major German companies.

* [Movies Example](https://github.com/Kotlin/dataframe/blob/master/examples/notebooks/movies/movies.ipynb)
— basic Kotlin DataFrame operations on data from [movielens](https://movielens.org/).

* [YouTube Example](https://github.com/Kotlin/dataframe/blob/master/examples/notebooks/youtube/Youtube.ipynb)
— explore YouTube videos with YouTube REST API and Kotlin Dataframe.

* [IMDb SQL Database Example](https://github.com/zaleslaw/KotlinDataFrame-SQL-Examples/blob/master/notebooks/imdb.ipynb)
— analyze IMDb data stored in MariaDB using Kotlin DataFrame
and visualize with [Kandy](https://kotlin.github.io/kandy/).


See also [Kandy User Guides](https://kotlin.github.io/kandy/user-guide.html)
and [Examples Gallery](https://kotlin.github.io/kandy/examples.html)
for the best data visualizations using Kotlin DataFrame and Kandy together!
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Usage with Kotlin Notebook Plugin
# Kotlin DataFrame Features in Kotlin Notebook

The [Kotlin Notebook Plugin for IntelliJ IDEA](https://plugins.jetbrains.com/plugin/16340-kotlin-notebook),
combined with Kotlin DataFrame, offers powerful data analysis capabilities within an interactive environment.
Here are the key features:

### Drag-and-Drop Data Files

You can quickly load data into `DataFrame` into a notebook by simply dragging and dropping a file
(.csv/.json/.xlsx and .geojson/.shp) directly into the notebook editor:

<video src="ktnb_drag_n_drop.mp4" controls/>

### Visual Data Exploration
**Page through your data**:
The pagination feature lets you move through your data one page at a time, making it possible to view large datasets.
Expand Down
4 changes: 2 additions & 2 deletions docs/StardustDocs/topics/guides/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Learn the basics of Kotlin DataFrame: reading data, applying transformations, an
This guide shows how to quickly get started with **Kotlin DataFrame**:
you'll learn how to load data, perform basic transformations, and build a simple plot using Kandy.

We recommend starting with [**Kotlin Notebook**](gettingStartedKotlinNotebook.md) for the best beginner experience —
We recommend [starting with **Kotlin Notebook**](gettingStartedKotlinNotebook.md) for the best beginner experience —
everything works out of the box,
including interactivity and rich DataFrame and plots rendering.
You can instantly see the results of each operation: view the contents of your DataFrames after every transformation,
Expand All @@ -36,7 +36,7 @@ To start working with Kotlin DataFrame in a notebook, run the cell with the next
```

This will load all necessary DataFrame dependencies (of the latest stable version) and all imports, as well as DataFrame
rendering. Learn more [here](gettingStartedKotlinNotebook.md).
rendering. Learn more [here](gettingStartedKotlinNotebook.md#integrate-kotlin-dataframe).

## Read DataFrame

Expand Down