We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5adcceb commit f24b923Copy full SHA for f24b923
RELEASE.rst
@@ -311,6 +311,7 @@ pandas 0.11.0
311
to non-fast apply) (GH3380_)
312
- Eliminated unicode errors on FreeBSD when using MPL GTK backend (GH3360_)
313
- Period.strftime should return unicode strings always (GH3363_)
314
+ - Respect passed read_* chunksize in get_chunk function (GH3406_)
315
316
.. _GH3294: https://github.com/pydata/pandas/issues/3294
317
.. _GH622: https://github.com/pydata/pandas/issues/622
@@ -425,6 +426,7 @@ pandas 0.11.0
425
426
.. _GH3308: https://github.com/pydata/pandas/issues/3308
427
.. _GH3311: https://github.com/pydata/pandas/issues/3311
428
.. _GH3380: https://github.com/pydata/pandas/issues/3380
429
+.. _GH3406: https://github.com/pydata/pandas/issues/3406
430
431
pandas 0.10.1
432
=============
pandas/io/parsers.py
@@ -649,9 +649,10 @@ def read(self, nrows=None):
649
def _create_index(self, col_dict, columns):
650
pass
651
652
- # backwards compatibility
653
- get_chunk = read
654
-
+ def get_chunk(self, size=None):
+ if size is None:
+ size = self.chunksize
655
+ return self.read(nrows=size)
656
657
def _is_index_col(col):
658
return col is not None and col is not False
@@ -1285,7 +1286,10 @@ def read(self, rows=None):
1285
1286
return index, columns, data
1287
1288
# legacy
1289
1290
1291
1292
1293
1294
def _convert_data(self, data):
1295
# apply converters
pandas/io/tests/test_parsers.py
@@ -456,7 +456,9 @@ def test_malformed(self):
456
2,3,4
457
"""
458
try:
459
- it = self.read_table(StringIO(data), sep=',', header=1, comment='#', iterator=True, chunksize=1, skiprows=[2])
+ it = self.read_table(StringIO(data), sep=',', header=1,
460
+ comment='#', iterator=True, chunksize=1,
461
+ skiprows=[2])
462
df = it.read(1)
463
it.read(2)
464
self.assert_(False)
@@ -876,6 +878,17 @@ def test_read_chunksize_named(self):
876
878
tm.assert_frame_equal(chunks[1], df[2:4])
877
879
tm.assert_frame_equal(chunks[2], df[4:])
880
881
+ def test_get_chunk_passed_chunksize(self):
882
+ data = """A,B,C
883
+1,2,3
884
+4,5,6
885
+7,8,9
886
+1,2,3"""
887
+ result = self.read_csv(StringIO(data), chunksize=2)
888
+
889
+ piece = result.get_chunk()
890
+ self.assertEqual(len(piece), 2)
891
892
def test_read_text_list(self):
893
data = """A,B,C\nfoo,1,2,3\nbar,4,5,6"""
894
as_list = [['A', 'B', 'C'], ['foo', '1', '2', '3'], ['bar',
0 commit comments