-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
107 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.nhl.dflib.seq; | ||
|
||
public class Sequences { | ||
|
||
public static Integer[] numberSequence(int h) { | ||
Integer[] rn = new Integer[h]; | ||
for (int i = 0; i < h; i++) { | ||
rn[i] = i; | ||
} | ||
|
||
return rn; | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
dflib/src/test/java/com/nhl/dflib/DataFrame_GroupBy_WindowFuncsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package com.nhl.dflib; | ||
|
||
import com.nhl.dflib.unit.SeriesAsserts; | ||
import org.junit.Test; | ||
|
||
public class DataFrame_GroupBy_WindowFuncsTest extends BaseDataFrameTest { | ||
|
||
@Test | ||
public void testGroupBy_RowNumbers0() { | ||
Index i = Index.forLabels("a", "b", "c"); | ||
DataFrame df = createDf(i, | ||
1, "x", "m", | ||
2, "y", "n", | ||
1, "z", "k", | ||
0, "a", "f", | ||
1, "x", "s"); | ||
|
||
Series<Integer> rn = df.group("a").rowNumbers(); | ||
new SeriesAsserts(rn).expectData(0, 0, 1, 0, 2); | ||
} | ||
|
||
@Test | ||
public void testGroupBy_RowNumbers1() { | ||
Index i = Index.forLabels("a", "b", "c"); | ||
DataFrame df = createDf(i, | ||
3, "x", "m", | ||
2, "y", "n", | ||
1, "z", "k", | ||
0, "a", "f", | ||
-1, "x", "s"); | ||
|
||
Series<Integer> rn = df.group("a").rowNumbers(); | ||
new SeriesAsserts(rn).expectData(0, 0, 0, 0, 0); | ||
} | ||
|
||
@Test | ||
public void testGroupBy_RowNumbers2() { | ||
Index i = Index.forLabels("a", "b", "c"); | ||
DataFrame df = createDf(i, | ||
3, "x", "m", | ||
0, "y", "n", | ||
3, "z", "k", | ||
3, "a", "f", | ||
1, "x", "s"); | ||
|
||
Series<Integer> rn = df.group("a").rowNumbers(); | ||
new SeriesAsserts(rn).expectData(0, 0, 1, 2, 0); | ||
} | ||
} |