Skip to content

Commit 3ac76b0

Browse files
committed
fixup! FEAT: implemented sas7bdat adapter using Pandas
1 parent 7615ccc commit 3ac76b0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

larray_editor/arrayadapter.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3689,6 +3689,8 @@ class DtaPathAdapter(AbstractPyReadStatPathAdapter):
36893689

36903690
@adapter_for('pandas.io.sas.sas7bdat.SAS7BDATReader')
36913691
class PandasSAS7BDATReaderAdapter(AbstractColumnarAdapter):
3692+
MAX_BYTES_TO_SKIP = 10_000_000
3693+
36923694
def __init__(self, data, attributes=None):
36933695
super().__init__(data, attributes=attributes)
36943696
reader = data
@@ -3734,8 +3736,10 @@ def get_values(self, h_start, v_start, h_stop, v_stop):
37343736
# skip to v_start
37353737
num_rows_to_skip = v_start - self._chunk_size - current_row
37363738
if num_rows_to_skip > 0:
3737-
logger.debug(f"must skip {num_rows_to_skip} rows")
3738-
if num_rows_to_skip * reader.row_lenth > 10_000_000:
3739+
bytes_to_skip = num_rows_to_skip * reader.row_length
3740+
logger.debug(f"must skip {num_rows_to_skip} rows "
3741+
f"(~{bytes_to_skip:_} bytes)")
3742+
if bytes_to_skip > self.MAX_BYTES_TO_SKIP:
37393743
# An exception would be eaten by the adapter so the user
37403744
# would never see it
37413745
msg = 'File is too large to display non top rows'

0 commit comments

Comments
 (0)