Skip to content

Commit d0293f8

Browse files
update readme
1 parent 858157b commit d0293f8

File tree

2 files changed

+2183
-13
lines changed

2 files changed

+2183
-13
lines changed

README.md

Lines changed: 72 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ It walks you through the core features of Kotlin DataFrame with minimal setup an
3232

3333
![quickstart_preview](docs/StardustDocs/images/guides/quickstart_preview.png)
3434

35-
3635
## Documentation
3736

3837
Explore [**documentation**](https://kotlin.github.io/dataframe) for details.
@@ -58,46 +57,99 @@ Check out this [notebook with new features](examples/notebooks/feature_overviews
5857

5958
## Setup
6059

60+
> For more detailed instructions on how to get started with Kotlin DataFrame, refer to the
61+
> [Getting Started](https://kotlin.github.io/dataframe/gettingstarted.html).
62+
63+
### Kotlin Notebook
64+
65+
You can use Kotlin DataFrame in [Kotlin Notebook](https://plugins.jetbrains.com/plugin/16340-kotlin-notebook),
66+
or other interactive environment with Kotlin Jupyter Kernel support, such as
67+
[Datalore](https://datalore.jetbrains.com/),
68+
and [Kotlin Jupyter](https://github.com/Kotlin/kotlin-jupyter).
69+
70+
You can include all the necessary dependencies and imports in the notebook using *line magic*:
71+
72+
```
73+
%use dataframe
74+
```
75+
76+
You can use `%useLatestDescriptors`
77+
to get the latest stable version without updating the Kotlin kernel:
78+
79+
```
80+
%useLatestDescriptors
81+
%use dataframe
82+
```
83+
84+
Or manually specify the version:
85+
86+
```
87+
%use dataframe($dataframe_version)
88+
```
89+
90+
Refer to the
91+
[Get started with Kotlin DataFrame in Kotlin Notebook](https://kotlin.github.io/dataframe/gettingstartedkotlinnotebook.html)
92+
for details.
93+
94+
### Gradle
95+
96+
Add dependencies in the build.gradle.kts script:
97+
6198
```kotlin
62-
implementation("org.jetbrains.kotlinx:dataframe:1.0.0-Beta2")
99+
dependencies {
100+
implementation("org.jetbrains.kotlinx:dataframe:1.0.0-Beta2")
101+
}
63102
```
64103

65-
Check out the [custom setup page](https://kotlin.github.io/dataframe/gettingstartedgradleadvanced.html) if you don't need some of the formats as dependencies,
104+
Make sure that you have `mavenCentral()` in the list of repositories:
105+
106+
```kotlin
107+
repositories {
108+
mavenCentral()
109+
}
110+
```
111+
112+
Refer to the
113+
[Get started with Kotlin DataFrame on Gradle](https://kotlin.github.io/dataframe/gettingstartedgradle.html)
114+
for details.
115+
Also, check out the [custom setup page](https://kotlin.github.io/dataframe/gettingstartedgradleadvanced.html)
116+
if you don't need some formats as dependencies,
66117
for Groovy, and for configurations specific to Android projects.
67118

68119
## Code example
69120

121+
This example of Kotlin DataFrame code with
122+
the [Compiler Plugin](https://kotlin.github.io/dataframe/compiler-plugin.html) enabled.
123+
See [the full project](https://github.com/Kotlin/dataframe/tree/master/examples/kotlin-dataframe-plugin-example).
124+
See also
125+
[this example in Kotlin Notebook](https://github.com/Kotlin/dataframe/tree/master/examples/notebooks/readme_example.ipynb).
126+
70127
```kotlin
71128
val df = DataFrame
72129
// Read DataFrame from the CSV file.
73130
.readCsv("https://raw.githubusercontent.com/Kotlin/dataframe/master/data/jetbrains_repositories.csv")
74131
// And convert it to match the `Repositories` schema.
75132
.convertTo<Repositories>()
76133

77-
// Let's update the DataFrame with some operations using these features.
78-
val reposUpdated = repos
134+
// Update the DataFrame.
135+
val reposUpdated = repos
79136
// Rename columns to CamelCase.
80-
// Note that after that, in the following operations, extension properties will have
81-
// new names corresponding to the column names.
82137
.renameToCamelCase()
83138
// Rename "stargazersCount" column to "stars".
84139
.rename { stargazersCount }.into("stars")
85-
// And we can immediately use the updated name in the filtering.
140+
// Filter by the number of stars:
86141
.filter { stars > 50 }
87142
// Convert values in the "topic" column (which were `String` initially)
88143
// to the list of topics.
89144
.convert { topics }.with {
90145
val inner = it.removeSurrounding("[", "]")
91146
if (inner.isEmpty()) emptyList() else inner.split(',').map(String::trim)
92147
}
93-
// Now "topics" is a `List<String>` column.
94148
// Add a new column with the number of topics.
95149
.add("topicCount") { topics.size }
96-
// Add a new column with the kind of repository.
97-
.add("kind") { getKind(fullName, topics) }
98150

99-
// Write the updated DataFrame to a CSV file.
100-
reposUpdated.writeCsv("jetbrains_repositories_new.csv")
151+
// Write the updated DataFrame to a CSV file.
152+
reposUpdated.writeCsv("jetbrains_repositories_new.csv")
101153
```
102154

103155
Explore [**more examples here**](https://kotlin.github.io/dataframe/guides-and-examples.html).
@@ -109,6 +161,13 @@ Explore [**more examples here**](https://kotlin.github.io/dataframe/guides-and-e
109161
* `ColumnGroup` — contains columns
110162
* `FrameColumn` — contains dataframes
111163

164+
## Visualisations
165+
166+
[Kandy](https://kotlin.github.io/kandy/welcome.html) plotting library provides seamless visualizations
167+
for your dataframes.
168+
169+
![kandy_preview](docs/StardustDocs/images/guides/kandy_gallery_preview.png)
170+
112171
## Kotlin, Kotlin Jupyter, Arrow, and JDK versions
113172

114173
This table shows the mapping between main library component versions and minimum supported Java versions.

0 commit comments

Comments
 (0)