Skip to content

Commit

Permalink
first draft of get started page
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahhaggarty committed Mar 8, 2023
1 parent ce9d023 commit 6357c18
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 16 deletions.
2 changes: 1 addition & 1 deletion docs/StardustDocs/d.tree
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
SYSTEM "https://helpserver.labs.jb.gg/help/schemas/mvp/product-profile.dtd">

<instance-profile id="d"
name="Dataframe"
name="DataFrame"
status="release"
start-page="overview.md">
<toc-element topic="gettingStarted.md"/>
Expand Down
176 changes: 162 additions & 14 deletions docs/StardustDocs/topics/gettingStarted.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,170 @@
[//]: # (title: Getting started)
[//]: # (title: Get started with DataFrame)

The Kotlin DataFrame library is a JVM Kotlin library for in-memory data manipulation.
Kotlin's DataFrame library gives you the power to manipulate data in your Kotlin projects.

![getting started image](gettingStarted.png)
This page explains how to:
* Set up the DataFrame library in an IntelliJ IDEA project with Gradle.
* Import and manipulate data.
* Export data.

## Installation
First, pick up the latest version of the Kotlin DataFrame library [here](https://search.maven.org/artifact/org.jetbrains.kotlinx/dataframe).
* If you wish to play with data in interactive mode, setup [Kotlin Kernel for Jupyter](installation.md#jupyter-notebook) and run DataFrame there
* If you have some JVM project, just add a dependency on the Kotlin DataFrame library like it's described on [Maven Central search](https://search.maven.org/artifact/org.jetbrains.kotlinx/dataframe) site
To use the DataFrame library with Jupyter notebooks or DataLore, follow the instructions on our [Installation page](installation.md).

## Examples
Hope that this documentation will help you to implement all the things you want to do with your data. To get inspiration, take a look at [examples](https://github.com/Kotlin/dataframe/tree/master/examples) folder. [Puzzles](https://github.com/Kotlin/dataframe/blob/master/examples/jupyter-notebooks/puzzles/40%20puzzles.ipynb) will quickly familiarize you with the power of DataFrame, and other notebooks and projects will show you some applications of DataFrame in practical data analysis.
## Install Kotlin

## Feedback and contributing
If you found a bug, or have an idea for a new feature, please [file an issue](https://github.com/Kotlin/dataframe/issues/new) in DataFrame GitHub repository.
Kotlin is included in each IntelliJ IDEA release.
Download and install [IntelliJ IDEA](https://www.jetbrains.com/idea/download/) to start using Kotlin.

If you wish to contribute, you're welcome! Choose an issue you like, let us know that you're working on it, and prepare a [pull request](https://github.com/Kotlin/dataframe/pulls). We'll review and merge it if everything goes well.
## Create Kotlin project

You can also give us feedback or ask a question in [#datascience](https://kotlinlang.slack.com/archives/C4W52CFEZ) channel of a Kotlin Slack.
1. In IntelliJ IDEA, select **File** | **New** | **Project**.
2. In the panel on the left, select **New Project**.
3. Name the new project and change its location, if necessary.

Good luck!
> Select the **Create Git repository** checkbox to place the new project under version control. You can enable this
> later at any time.
>
{type="tip"}

4. From the **Language** list, select **Kotlin**.
5. Select the **Gradle** build system.
6. From the **JDK list**, select the [JDK](https://www.oracle.com/java/technologies/downloads/) that you want to use in
your project.
* If the JDK is installed on your computer, but not defined in the IDE, select **Add JDK** and specify the path to the
JDK home directory.
* If you don't have the necessary JDK on your computer, select **Download JDK**.
7. From the **Gradle DSL** list, select **Kotlin** or **Groovy**.
8. Select the **Add sample code** checkbox to create a file with a sample `"Hello World!"` application.
9. Click **Create**.

You have successfully created a project with Gradle.

### Update Gradle dependencies

In your Gradle build file (`build.gradle.kts`), add the DataFrame library as a dependency:

<tabs>
<tab title="Kotlin DSL">

```kotlin
dependencies {
implementation("org.jetbrains.kotlinx:dataframe:%dataFrameVersion%")
}
```

</tab>

<tab title="Groovy DSL">

```kotlin
dependencies {
implementation 'org.jetbrains.kotlinx:dataframe:%dataFrameVersion%'
}
```

</tab>

</tabs>

### Add imports

In `src/main/kotlin/Main.kt`, add the following imports at the top of the file:

```kotlin
import org.jetbrains.kotlinx.dataframe.DataFrame
import org.jetbrains.kotlinx.dataframe.io.*
import org.jetbrains.kotlinx.dataframe.api.*
```

## Import data

Download and save our [movie sample data](https://raw.githubusercontent.com/Kotlin/dataframe/master/examples/idea-examples/movies/src/main/resources/movies.csv) to the root directory of your project.

Delete the `println()` functions and comments from your main function in `Main.kt`.

To import the movie sample data into a data frame and print it, inside your main function in `Main.kt`, add the following code:

```kotlin
// Import your data to a data frame
var df = DataFrame.read("movies.csv")

// Print your data frame
println(df)
```

## Manipulate data

To print some information about your data frame and sort your data, add the following additional lines of code:

```kotlin
// Print some information about the data frame
println(df.columnNames()) // Print column names
println(df.count()) // Print number of rows

// Sort your data alphabetically by title and print
df = df.sortBy("title")
println(df)
```

## Export data

To export the current version of your data frame in CSV format, add the following additional lines of code and run `Main.kt`.

```kotlin
// Export your manipulated data to CSV format
df.writeCSV("movies-by-title.csv")
```


<code-block lang="console" collapsed-title="Example terminal output" collapsible="true">
movieId title genres
0 9b30aff7943f44579e92c261f3adc193 Women in Black (1997) Fantasy|Suspenseful|Comedy
1 2a1ba1fc5caf492a80188e032995843e Bumblebee Movie (2007) Comedy|Jazz|Family|Animation
2 f44ceb4771504342bb856d76c112d5a6 Magical School Boy and the Rock of Wi... Fantasy|Growing up|Magic
3 43d02fb064514ff3bd30d1e3a7398357 Master of the Jewlery: The Company of... Fantasy|Magic|Suspenseful
4 6aa0d26a483148998c250b9c80ddf550 Sun Conflicts: Part IV: A Novel Espai... Fantasy
5 eace16e59ce24eff90bf8924eb6a926c The Outstanding Bulk (2008) Fantasy|Superhero|Family
6 ae916bc4844a4bb7b42b70d9573d05cd In Automata (2014) Horror|Existential
7 c1f0a868aeb44c5ea8d154ec3ca295ac Interplanetary (2014) Sci-fi|Futuristic
8 9595b771f87f42a3b8dd07d91e7cb328 Woods Run (1994) Family|Drama
9 aa9fc400e068443488b259ea0802a975 Anthropod-Dude (2002) Superhero|Fantasy|Family|Growing up
10 22d20c2ba11d44cab83aceea39dc00bd The Chamber (2003) Comedy|Drama
11 8cf4d0c1bd7b41fab6af9d92c892141f That Thing About an Iceberg (1997) Drama|History|Family|Romance
12 c2f3e7588da84684a7d78d6bd8d8e1f4 Vehicles (2006) Animation|Family
13 ce06175106af4105945f245161eac3c7 Playthings Tale (1995) Animation|Family
14 ee28d7e69103485c83e10b8055ef15fb Metal Man 2 (2010) Fantasy|Superhero|Family
15 c32bdeed466f4ec09de828bb4b6fc649 Surgeon Odd in the Omniverse of Crazy... Fantasy|Superhero|Family|Horror
16 d4a325ab648a42c4a2d6f35dfabb387f Bad Dream on Pine Street (1984) Horror
17 60ebe74947234ddcab49dea1a958faed The Shimmering (1980) Horror
18 f24327f2b05147b197ca34bf13ae3524 Krubit: Societal Teachings for Do Man... Comedy
19 2bb29b3a245e434fa80542e711fd2cee This is No Movie (1950) (no genres listed)
[movieId, title, genres]
20
movieId title genres
0 aa9fc400e068443488b259ea0802a975 Anthropod-Dude (2002) Superhero|Fantasy|Family|Growing up
1 d4a325ab648a42c4a2d6f35dfabb387f Bad Dream on Pine Street (1984) Horror
2 2a1ba1fc5caf492a80188e032995843e Bumblebee Movie (2007) Comedy|Jazz|Family|Animation
3 ae916bc4844a4bb7b42b70d9573d05cd In Automata (2014) Horror|Existential
4 c1f0a868aeb44c5ea8d154ec3ca295ac Interplanetary (2014) Sci-fi|Futuristic
5 f24327f2b05147b197ca34bf13ae3524 Krubit: Societal Teachings for Do Man... Comedy
6 f44ceb4771504342bb856d76c112d5a6 Magical School Boy and the Rock of Wi... Fantasy|Growing up|Magic
7 43d02fb064514ff3bd30d1e3a7398357 Master of the Jewlery: The Company of... Fantasy|Magic|Suspenseful
8 ee28d7e69103485c83e10b8055ef15fb Metal Man 2 (2010) Fantasy|Superhero|Family
9 ce06175106af4105945f245161eac3c7 Playthings Tale (1995) Animation|Family
10 6aa0d26a483148998c250b9c80ddf550 Sun Conflicts: Part IV: A Novel Espai... Fantasy
11 c32bdeed466f4ec09de828bb4b6fc649 Surgeon Odd in the Omniverse of Crazy... Fantasy|Superhero|Family|Horror
12 8cf4d0c1bd7b41fab6af9d92c892141f That Thing About an Iceberg (1997) Drama|History|Family|Romance
13 22d20c2ba11d44cab83aceea39dc00bd The Chamber (2003) Comedy|Drama
14 eace16e59ce24eff90bf8924eb6a926c The Outstanding Bulk (2008) Fantasy|Superhero|Family
15 60ebe74947234ddcab49dea1a958faed The Shimmering (1980) Horror
16 2bb29b3a245e434fa80542e711fd2cee This is No Movie (1950) (no genres listed)
17 c2f3e7588da84684a7d78d6bd8d8e1f4 Vehicles (2006) Animation|Family
18 9b30aff7943f44579e92c261f3adc193 Women in Black (1997) Fantasy|Suspenseful|Comedy
19 9595b771f87f42a3b8dd07d91e7cb328 Woods Run (1994) Family|Drama
</code-block>

Congratulations! You have successfully used Kotlin's DataFrame library to import, manipulate and export data.

## Next steps
* Learn more about how to [import and export data](io.md)
* Learn about our different [access APIs](apiLevels.md)
* Explore the many different [operations that you can perform](operations.md)
10 changes: 10 additions & 0 deletions docs/StardustDocs/topics/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,13 @@ dfClean.groupBy { From into "origin" }.aggregate {
pivot { To }.sum { recentDelays.intCols() } into "total delays to"
}
```

## Contribute and give feedback

If you find a bug, or have an idea for a new feature, [file an issue](https://github.com/Kotlin/dataframe/issues/new) in our DataFrame GitHub repository.

Additionally, we welcome contributions. To get stared, choose an issue and let us know that you're working on it. When you're ready, create a [pull request](https://github.com/Kotlin/dataframe/pulls).

You can also contact us in the [#datascience](https://kotlinlang.slack.com/archives/C4W52CFEZ) channel of Kotlin Slack.

Good luck!
2 changes: 1 addition & 1 deletion docs/StardustDocs/v.list
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vars SYSTEM "https://helpserver.labs.jb.gg/help/schemas/mvp/vars.dtd">
<vars>

<var name="dataFrameVersion" value="0.9.1" type="string"/>
</vars>

0 comments on commit 6357c18

Please sign in to comment.