Skip to content

Commit 3bd1b35

Browse files
committed
Move more code to cython
1 parent bdc9a06 commit 3bd1b35

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

pandas/io/sas/sas7bdat.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import numpy as np
2121
import struct
2222
import pandas.io.sas.sas_constants as const
23-
from .saslib import (_rle_decompress, _rdc_decompress, _readline)
23+
from .saslib import (_rle_decompress, _rdc_decompress, _do_read)
2424

2525

2626
class _subheader_pointer(object):
@@ -549,10 +549,7 @@ def read(self, nrows=None):
549549
self._byte_chunk = np.empty((nd, 8 * nrows), dtype=np.uint8)
550550

551551
self._current_row_in_chunk_index = 0
552-
for i in range(nrows):
553-
done = _readline(self)
554-
if done:
555-
break
552+
_do_read(self, nrows)
556553

557554
rslt = self._chunk_to_dataframe()
558555
if self.index is not None:

pandas/io/sas/saslib.pyx

+9
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,15 @@ def _rdc_decompress(int result_length, np.ndarray[uint8_t, ndim=1] inbuff):
194194
return np.asarray(outbuff).tostring()
195195

196196

197+
def _do_read(parser, int nrows):
198+
cdef int i
199+
200+
for i in range(nrows):
201+
done = _readline(parser)
202+
if done:
203+
break
204+
205+
197206
def _readline(parser):
198207

199208
cdef int offset

0 commit comments

Comments
 (0)