Skip to content

Commit ba1761c

Browse files
committed
fixup! adding tests and comments, missing types for median, expanding cumSum
1 parent 860ea39 commit ba1761c

File tree

1 file changed

+8
-8
lines changed
  • core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api

1 file changed

+8
-8
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/cumSum.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,19 @@ public fun <T : Number?> DataColumn<T>.cumSum(skipNA: Boolean = defaultCumSumSki
2929

3030
typeOf<Int>() -> cast<Int>().cumSum().cast()
3131

32-
// TODO cumSum for Byte returns Int but is cast back to T: Byte
33-
typeOf<Byte>() -> cast<Byte>().cumSum().cast()
32+
// TODO cumSum for Byte returns Int but is converted back to T: Byte
33+
typeOf<Byte>() -> cast<Byte>().cumSum().map { it.toByte() }.cast()
3434

35-
// TODO cumSum for Short returns Int but is cast back to T: Short
36-
typeOf<Short>() -> cast<Short>().cumSum().cast()
35+
// TODO cumSum for Short returns Int but is converted back to T: Short
36+
typeOf<Short>() -> cast<Short>().cumSum().map { it.toShort() }.cast()
3737

3838
typeOf<Int?>() -> cast<Int?>().cumSum(skipNA).cast()
3939

40-
// TODO cumSum for Byte? returns Int? but is cast back to T: Byte?
41-
typeOf<Byte?>() -> cast<Byte?>().cumSum(skipNA).cast()
40+
// TODO cumSum for Byte? returns Int? but is converted back to T: Byte?
41+
typeOf<Byte?>() -> cast<Byte?>().cumSum(skipNA).map { it?.toByte() }.cast()
4242

43-
// TODO cumSum for Short? returns Int? but is cast back to T: Short?
44-
typeOf<Short?>() -> cast<Short?>().cumSum(skipNA).cast()
43+
// TODO cumSum for Short? returns Int? but is converted back to T: Short?
44+
typeOf<Short?>() -> cast<Short?>().cumSum(skipNA).map { it?.toShort() }.cast()
4545

4646
typeOf<Long>() -> cast<Long>().cumSum().cast()
4747

0 commit comments

Comments
 (0)