@@ -1040,6 +1040,12 @@ describe("DataFrame", function () {
10401040 const df = new dfd . DataFrame ( data ) ;
10411041 assert . deepEqual ( ( df . pctChange ( sf ) ) . values , [ [ - 1 , 0 , 3 ] , [ 9 , 4 , 9 ] , [ 0 , 0 , 2 ] ] ) ;
10421042 } ) ;
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+ } ) ;
10431049 it ( "Return difference in percentage of a DataFrame with along axis 0 (column-wise), previous column" , function ( ) {
10441050 const data = [ [ 0 , 2 , 4 ] , [ 10 , 10 , 10 ] , [ 1 , 2 , 3 ] ] ;
10451051 const df = new dfd . DataFrame ( data ) ;
@@ -1085,6 +1091,12 @@ describe("DataFrame", function () {
10851091 const df = new dfd . DataFrame ( data ) ;
10861092 assert . deepEqual ( ( df . diff ( sf ) ) . values , [ [ - 1 , 0 , 3 ] , [ 9 , 8 , 9 ] , [ 0 , 0 , 2 ] ] ) ;
10871093 } ) ;
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+ } ) ;
10881100 it ( "Return difference of a DataFrame with along axis 0 (column-wise), previous column" , function ( ) {
10891101 const data = [ [ 0 , 2 , 4 ] , [ 10 , 10 , 10 ] , [ 1 , 2 , 3 ] ] ;
10901102 const df = new dfd . DataFrame ( data ) ;
0 commit comments