# Setup Kotlin DataFrame in Kotlin Notebook

> For the complete documentation index, see [llms.txt](https://kotlin.github.io/dataframe/llms.txt).

[Kotlin Notebook](https://kotlinlang.org/docs/kotlin-notebook-overview.html) is an interactive environment integrated into [IntelliJ IDEA](https://www.jetbrains.com/idea/) (and can be easily added in [Android Studio](https://developer.android.com/studio)), 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 a 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.

* 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 `Cmd+N` (primary_macOS), `Alt+Insert` (primary_Win-Linux) or right-click the project tree, then select `Kotlin Notebook`.

![Create Kotlin Notebook file](images/new_ktn_file.png)

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-rc02n)
```

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

```
%useLatestDescriptors
%use dataframe
```

> **Warning:**
> For version `1.0.0-rc02`, in notebooks use version `1.0.0-rc02n` instead. The regular version [does not work with statistical functions](https://github.com/Kotlin/dataframe/issues/1116). The `n` version includes a [patch](https://github.com/Kotlin/dataframe/pull/1435) that resolves this issue.
>
>
>
> When using `%use dataframe` in the latest kernel version or with the `%useLatestDescriptors` this version is applied automatically.
>
>
>
> If you want to include `kandy`, list it after `dataframe`:
>
>
>
>
> ```KOTLIN
> %useLatestDescriptors
> %use dataframe, kandy
> // or
> %use dataframe(1.0.0-rc02n), kandy(0.8.6)
> ```

## Hello World

Let’s create your first [DataFrame](dataframe.html) 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](images/df_output.png)

## Next Steps

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

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

* Discover powerful [Kotlin DataFrame Features in Kotlin Notebook](kotlin-dataframe-features-in-kotlin-notebook.html) that make exploring and understanding your data easier and more effective.

## Memory Errors?

* If you are experiencing `OutOfMemoryError`s and heap space errors, you can adjust Notebook's memory settings independently of IntelliJ IDEA's memory settings.

* In IntelliJ IDEA, go to Settings... Tools... Kotlin Notebook and increase the `Max heap size`

