File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -427,6 +427,18 @@ def test_read_nrows(self):
427427 with tm .assertRaisesRegexp (ValueError , msg ):
428428 self .read_csv (StringIO (self .data1 ), nrows = 'foo' )
429429
430+ def test_read_nrows_large (self ):
431+ # GH-7626 - Read only nrows of data read in for large inputs (>262144b)
432+ header_narrow = '\t ' .join (['COL_HEADER_' + str (i ) for i in range (10 )]) + '\n '
433+ data_narrow = '\t ' .join (['somedatasomedatasomedata1' for i in range (10 )])+ '\n '
434+ header_wide = '\t ' .join (['COL_HEADER_' + str (i ) for i in range (15 )]) + '\n '
435+ data_wide = '\t ' .join (['somedatasomedatasomedata2' for i in range (15 )])+ '\n '
436+ test_input = header_narrow + data_narrow * 1050 + header_wide + data_wide * 2
437+
438+ df = self .read_table (StringIO (test_input ), nrows = 1010 )
439+
440+ self .assertTrue (df .size == 1010 * 10 )
441+
430442 def test_read_chunksize (self ):
431443 reader = self .read_csv (StringIO (self .data1 ), index_col = 0 , chunksize = 2 )
432444 df = self .read_csv (StringIO (self .data1 ), index_col = 0 )
You can’t perform that action at this time.
0 commit comments