@@ -1040,6 +1040,12 @@ describe("DataFrame", function () {
1040
1040
const df = new dfd . DataFrame ( data ) ;
1041
1041
assert . deepEqual ( ( df . pctChange ( sf ) ) . values , [ [ - 1 , 0 , 3 ] , [ 9 , 4 , 9 ] , [ 0 , 0 , 2 ] ] ) ;
1042
1042
} ) ;
1043
+ it ( "Return difference in percentage of a DataFrame with a Series along axis 0" , function ( ) {
1044
+ const data = [ [ 0 , 2 , 4 ] , [ 10 , 10 , 10 ] , [ 1 , 2 , 3 ] ] ;
1045
+ const sf = new dfd . Series ( [ 1 , 2 , 1 ] ) ;
1046
+ const df = new dfd . DataFrame ( data ) ;
1047
+ assert . deepEqual ( ( df . pctChange ( sf , { axis : 0 } ) ) . values , [ [ - 1 , 1 , 3 ] , [ 4 , 4 , 4 ] , [ 0 , 1 , 2 ] ] ) ;
1048
+ } ) ;
1043
1049
it ( "Return difference in percentage of a DataFrame with along axis 0 (column-wise), previous column" , function ( ) {
1044
1050
const data = [ [ 0 , 2 , 4 ] , [ 10 , 10 , 10 ] , [ 1 , 2 , 3 ] ] ;
1045
1051
const df = new dfd . DataFrame ( data ) ;
@@ -1085,6 +1091,12 @@ describe("DataFrame", function () {
1085
1091
const df = new dfd . DataFrame ( data ) ;
1086
1092
assert . deepEqual ( ( df . diff ( sf ) ) . values , [ [ - 1 , 0 , 3 ] , [ 9 , 8 , 9 ] , [ 0 , 0 , 2 ] ] ) ;
1087
1093
} ) ;
1094
+ it ( "Return difference of a DataFrame with a Series along axis 0" , function ( ) {
1095
+ const data = [ [ 0 , 2 , 4 ] , [ 10 , 10 , 10 ] , [ 1 , 2 , 3 ] ] ;
1096
+ const sf = new dfd . Series ( [ 1 , 2 , 1 ] ) ;
1097
+ const df = new dfd . DataFrame ( data ) ;
1098
+ assert . deepEqual ( ( df . diff ( sf , { axis : 0 } ) ) . values , [ [ - 1 , 1 , 3 ] , [ 8 , 8 , 8 ] , [ 0 , 1 , 2 ] ] ) ;
1099
+ } ) ;
1088
1100
it ( "Return difference of a DataFrame with along axis 0 (column-wise), previous column" , function ( ) {
1089
1101
const data = [ [ 0 , 2 , 4 ] , [ 10 , 10 , 10 ] , [ 1 , 2 , 3 ] ] ;
1090
1102
const df = new dfd . DataFrame ( data ) ;
0 commit comments