@@ -1266,7 +1266,7 @@ describe("DataFrame", function () {
12661266 [ 2 , 4 , 6 , "c" ] ] ;
12671267
12681268 const df = new DataFrame ( data , { "columns" : [ "col1" , "col2" , "col3" , "col4" ] } ) ;
1269- const df_sort = df . sortValues ( "col3" ) as DataFrame
1269+ const df_sort = df . sortValues ( "col3" )
12701270 const expected = [ [ 360 , 180 , 1 , "b" ] , [ 0 , 2 , 4 , "a" ] , [ 2 , 4 , 6 , "c" ] ] ;
12711271 assert . deepEqual ( df_sort . values , expected ) ;
12721272 assert . deepEqual ( df_sort . index , [ 1 , 0 , 2 ] ) ;
@@ -1297,9 +1297,21 @@ describe("DataFrame", function () {
12971297 [ 2 , 4 , 6 , "c" ] ] ;
12981298
12991299 const df = new DataFrame ( data , { "columns" : [ "col1" , "col2" , "col3" , "col4" ] } ) ;
1300- const expected = [ [ 2 , 4 , 6 , 'c' ] , [ 360 , 180 , 1 , 'b' ] , [ 0 , 2 , 4 , 'a' ] ] ;
1301- assert . deepEqual ( ( df . sortValues ( "col4" , { "ascending" : false } ) as DataFrame ) . values , expected ) ;
1300+ const expected = [ [ 2 , 4 , 6 , "c" ] , [ 360 , 180 , 1 , "b" ] , [ 0 , 2 , 4 , "a" ] ]
1301+ assert . deepEqual ( df . sortValues ( "col4" , { "ascending" : false } ) . values , expected ) ;
13021302 } ) ;
1303+
1304+ it ( "sort works for Date string" , function ( ) {
1305+ const data = {
1306+ date : [ '1974-02-19' , '1955-12-06' , '1963-11-18' ]
1307+ } ;
1308+ const df = new DataFrame ( data ) ;
1309+ const expected1 = [ [ '1974-02-19' ] , [ '1963-11-18' ] , [ '1955-12-06' ] ]
1310+ const expected2 = [ [ '1955-12-06' ] , [ '1963-11-18' ] , [ '1974-02-19' ] ]
1311+ assert . deepEqual ( df . sortValues ( "date" , { "ascending" : false } ) . values , expected1 ) ;
1312+ assert . deepEqual ( df . sortValues ( "date" , { "ascending" : true } ) . values , expected2 ) ;
1313+ } ) ;
1314+
13031315 it ( "Sort duplicate DataFrame with duplicate columns" , function ( ) {
13041316
13051317 const data = {
@@ -1320,7 +1332,7 @@ describe("DataFrame", function () {
13201332 [ 5 , 8 ] ,
13211333 [ 5 , 2 ] ,
13221334 [ 6 , 9 ] ] ;
1323- assert . deepEqual ( ( df . sortValues ( "A" , { "ascending" : true } ) as DataFrame ) . values , expected ) ;
1335+ assert . deepEqual ( df . sortValues ( "A" , { "ascending" : true } ) . values , expected ) ;
13241336 } ) ;
13251337 it ( "sort index in descending order and retains index" , function ( ) {
13261338 let data = [ [ 0 , 2 , 4 , "b" ] ,
@@ -1330,9 +1342,9 @@ describe("DataFrame", function () {
13301342 let df = new DataFrame ( data , { "columns" : [ "col1" , "col2" , "col3" , "col4" ] , index : [ "b" , "a" , "c" ] } ) ;
13311343 let df2 = df . sortIndex ( { ascending : false } ) ;
13321344 let rslt = [ "c" , "b" , "a" ] ;
1333-
13341345 assert . deepEqual ( df2 . index , rslt ) ;
13351346 } ) ;
1347+
13361348 } ) ;
13371349
13381350 describe ( "copy" , function ( ) {
0 commit comments