Skip to content
Merged
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
@@ -1,10 +1,13 @@
package org.jetbrains.kotlinx.dataframe.testSets.person

import io.kotest.matchers.shouldBe
import org.jetbrains.kotlinx.dataframe.api.columnOf
import org.jetbrains.kotlinx.dataframe.api.count
import org.jetbrains.kotlinx.dataframe.api.sort
import org.jetbrains.kotlinx.dataframe.api.sortBy
import org.jetbrains.kotlinx.dataframe.api.sortByDesc
import org.jetbrains.kotlinx.dataframe.api.sortDesc
import org.jetbrains.kotlinx.dataframe.api.valueCounts
import org.junit.Test

class DataColumnTests : BaseTest() {
Expand All @@ -14,4 +17,12 @@ class DataColumnTests : BaseTest() {
typed.age.sort() shouldBe typed.sortBy { age }.age
typed.age.sortDesc() shouldBe typed.sortByDesc { age }.age
}

@Test
fun `value counts`() {
val languages by columnOf("Kotlin", "Kotlin", null, null, "C++")
val languageCounts = languages.valueCounts()
languageCounts[languages].values() shouldBe listOf("Kotlin", "C++")
languageCounts.count.values() shouldBe listOf(2, 1)
}
}