Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,7 @@ class Access : TestBase() {

@Test
@TransformDataFrameExpressions
fun getColumnsByName_properties() {
// SampleStart
df[df.age, df.weight]
// SampleEnd
}

@Test
@TransformDataFrameExpressions
fun getColumnsByName_strings() {
fun getColumnsByName() {
// SampleStart
df["age", "weight"]
// SampleEnd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,11 @@ class Create : TestBase() {
@TransformDataFrameExpressions
fun createDataFrameFromColumns() {
// SampleStart

val name by columnOf("Alice", "Bob", "Charlie")
val age by columnOf(15, 20, 22)

// DataFrame with 2 columns
val df = dataFrameOf(name, age)
val df = dataFrameOf(
"name" to columnOf("Alice", "Bob", "Charlie"),
"age" to columnOf(15, 20, 22)
)
// SampleEnd
}

Expand Down
8 changes: 4 additions & 4 deletions docs/StardustDocs/topics/createDataFrame.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ val df = dataFrameOf(
<!---FUN createDataFrameFromColumns-->

```kotlin
val name by columnOf("Alice", "Bob", "Charlie")
val age by columnOf(15, 20, 22)

// DataFrame with 2 columns
val df = dataFrameOf(name, age)
val df = dataFrameOf(
"name" to columnOf("Alice", "Bob", "Charlie"),
"age" to columnOf(15, 20, 22)
)
```

<!---END-->
Expand Down
36 changes: 13 additions & 23 deletions docs/StardustDocs/topics/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,6 @@

Two ways to create [`DataFrame`](DataFrame.md) with a subset of columns:

**indexing:**

<!---FUN getColumnsByName-->
<tabs>
<tab title="Properties">

```kotlin
df[df.age, df.weight]
```

</tab>
<tab title="Strings">

```kotlin
df["age", "weight"]
```

</tab></tabs>
<inline-frame src="resources/org.jetbrains.kotlinx.dataframe.samples.api.Access.getColumnsByName.html" width="100%"/>
<!---END-->

See [DataFrame indexing](indexing.md)

**selecting:**

<!---FUN select-->
Expand All @@ -52,3 +29,16 @@ df.select("age", "weight")
**Related operations**: [remove](remove.md)

See [column selectors](ColumnSelectors.md)

**indexing:**

<!---FUN getColumnsByName-->

```kotlin
df["age", "weight"]
```

<inline-frame src="resources/org.jetbrains.kotlinx.dataframe.samples.api.Access.getColumnsByName.html" width="100%"/>
<!---END-->

See [DataFrame indexing](indexing.md)