Scala: equivalente de np.digitize para agrupar datos

With scala I have some data, for ex.

val values = Seq(0, 2, 10, 50)

And I defined buckets, eg.

val buckets = TreeMap[Int, Double]((0, -0.001),
                                   (1, 1.5),
                                   (2, 5),
                                   (3, 20)

Then I want, from my values, to have the buckets indexes, eg.

val result = Seq(0, 1, 2, 3)

In python this can be done with np.digitize, in scala I can't find an equivalent with Nd4j or Breeze.

Is there an optimized solution to this?

Answer:1

I have project with camel parent. <parent> <groupId>org.apache.camel</groupId> <artifactId>camel-parent</artifactId> <version>2.23.1</...

I've used chkBox.setIcon(); chkBox.setSelectedIcon(); chkBox.setDisabledIcon(); chkBox.setDisabledSelectedIcon(); to set custom icons for my JCheckbox. But now, if the focus moves to one of the ...

I want to create an index for an specific sql call in which I join two tables and I don't know how to insert the outer column. This is what I currently have: <changeSet id="1234" author="name" &...

I am trying to create a splash screen that displays a gif animation. The thing about my Splash screen I want to actually make it appear after the main() function returns (Main() just creates a login ...