@@ -1668,7 +1668,7 @@ describe("DataFrame", function () {
16681668 assert . deepEqual ( df . values , expected ) ;
16691669 } ) ;
16701670 it ( "replace all undefined value" , function ( ) {
1671- const data = [ [ undefined , 1 , 2 , 3 ] , [ 3 , 4 , undefined , 9 ] , [ 5 , 6 , 7 , 8 ] ] ;
1671+ const data = [ [ undefined , 1 , 2 , 3 ] , [ 3 , 4 , null , 9 ] , [ 5 , 6 , 7 , 8 ] ] ;
16721672 const columns = [ "A" , "B" , "C" , "D" ] ;
16731673 const df = new DataFrame ( data , { columns : columns } ) ;
16741674
@@ -1677,6 +1677,17 @@ describe("DataFrame", function () {
16771677 const df_filled = df . fillNa ( - 999 ) as DataFrame
16781678 assert . deepEqual ( df_filled . values , expected ) ;
16791679 } ) ;
1680+ it ( "replace all undefined value with 0 works" , function ( ) {
1681+ const data = [ [ undefined , 1 , 2 , 3 ] , [ 3 , 4 , null , 9 ] , [ 5 , NaN , 7 , 8 ] ] ;
1682+ const columns = [ "A" , "B" , "C" , "D" ] ;
1683+ const df = new DataFrame ( data , { columns : columns } ) ;
1684+
1685+ const expected = [ [ 0 , 1 , 2 , 3 ] , [ 3 , 4 , 0 , 9 ] , [ 5 , 0 , 7 , 8 ] ] ;
1686+
1687+ const df_filled = df . fillNa ( 0 ) as DataFrame
1688+ assert . deepEqual ( df_filled . values , expected ) ;
1689+ } ) ;
1690+
16801691
16811692 it ( "Fills only a specified column" , function ( ) {
16821693 const data = [ [ 1 , 2 , 3 ] ,
0 commit comments