@@ -18,27 +18,27 @@ const indexLoc = (ndframe, kwargs) => {
1818 if ( Array . isArray ( kwargs [ "rows" ] ) ) {
1919 if ( kwargs [ "rows" ] . length == 1 && typeof kwargs [ "rows" ] [ 0 ] == "string" ) {
2020 if ( kwargs [ "rows" ] [ 0 ] . includes ( ":" ) ) {
21- let row_split = kwargs [ "rows" ] [ 0 ] . split ( ":" ) ;
21+ let column_split = kwargs [ "rows" ] [ 0 ] . split ( ":" ) ;
2222
2323 if ( kwargs [ 'type' ] == 'loc' ) {
2424 let start , end ;
2525
26- if ( isNaN ( Number ( row_split [ 0 ] ) ) ) {
27- start = ndframe . index . indexOf ( row_split [ 0 ] ) ;
26+ if ( isNaN ( Number ( column_split [ 0 ] ) ) ) {
27+ start = ndframe . index . indexOf ( column_split [ 0 ] ) ;
2828 } else {
29- start = Number ( row_split [ 0 ] ) ;
29+ start = Number ( column_split [ 0 ] ) ;
3030 }
3131
32- if ( isNaN ( Number ( row_split [ 1 ] ) ) ) {
33- end = ndframe . index . lastIndexOf ( row_split [ 1 ] ) - 1 || ndframe . values . length - 1 ;
32+ if ( isNaN ( Number ( column_split [ 1 ] ) ) ) {
33+ end = ndframe . index . lastIndexOf ( column_split [ 1 ] ) - 1 || ndframe . values . length - 1 ;
3434 } else {
35- end = Number ( row_split [ 1 ] ) - 1 || ndframe . values . length - 1 ;
35+ end = Number ( column_split [ 1 ] ) - 1 || ndframe . values . length - 1 ;
3636 }
3737
3838 rows = utils . __range ( start , end ) ;
3939 } else {
40- let start = parseInt ( row_split [ 0 ] ) || 0 ;
41- let end = parseInt ( row_split [ 1 ] ) - 1 || ndframe . values . length - 1 ;
40+ let start = parseInt ( column_split [ 0 ] ) || 0 ;
41+ let end = parseInt ( column_split [ 1 ] ) - 1 || ndframe . values . length - 1 ;
4242
4343 if ( typeof start == "number" && typeof end == "number" ) {
4444 rows = utils . __range ( start , end ) ;
@@ -84,15 +84,16 @@ const indexLoc = (ndframe, kwargs) => {
8484 if ( Object . prototype . hasOwnProperty . call ( kwargs , "columns" ) ) {
8585 if ( Array . isArray ( kwargs [ "columns" ] ) ) {
8686 if ( kwargs [ "columns" ] . length == 1 && kwargs [ "columns" ] [ 0 ] . includes ( ":" ) ) {
87- let row_split = kwargs [ "columns" ] [ 0 ] . split ( ":" ) ;
87+ let column_split = kwargs [ "columns" ] [ 0 ] . split ( ":" ) ;
8888 let start , end ;
8989
90- if ( kwargs [ "type" ] == "iloc" || row_split [ 0 ] == "" ) {
91- start = parseInt ( row_split [ 0 ] ) || 0 ;
92- end = parseInt ( row_split [ 1 ] ) - 1 || ndframe . values [ 0 ] . length - 1 ;
90+ if ( kwargs [ "type" ] == "iloc" || column_split [ 0 ] == "" ) {
91+ start = parseInt ( column_split [ 0 ] ) || 0 ;
92+ end = parseInt ( column_split [ 1 ] ) - 1 === 0 ? 0 : parseInt ( column_split [ 1 ] ) - 1 ;
93+ console . log ( start , end ) ;
9394 } else {
94- start = parseInt ( ndframe . columns . indexOf ( row_split [ 0 ] ) ) ;
95- end = parseInt ( ndframe . columns . indexOf ( row_split [ 1 ] ) ) - 1 ;
95+ start = parseInt ( ndframe . columns . indexOf ( column_split [ 0 ] ) ) ;
96+ end = parseInt ( ndframe . columns . indexOf ( column_split [ 1 ] ) ) - 1 ;
9697 }
9798
9899 if ( typeof start == "number" && typeof end == "number" ) {
0 commit comments