Skip to content

Commit b3456a7

Browse files
committed
Fix reading some RDC compressed pages
1 parent 3e3bb90 commit b3456a7

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

doc/source/whatsnew/v1.5.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,7 @@ I/O
813813
- Bug in :func:`read_excel` when reading a ``.ods`` file with newlines between xml elements (:issue:`45598`)
814814
- Bug in :func:`read_parquet` when ``engine="fastparquet"`` where the file was not closed on error (:issue:`46555`)
815815
- :meth:`to_html` now excludes the ``border`` attribute from ``<table>`` elements when ``border`` keyword is set to ``False``.
816+
- Bug in :func:`read_sas` with certain types of compressed SAS7BDAT files (:issue:`35545`)
816817
-
817818

818819
Period

pandas/io/sas/sas7bdat.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,9 @@ def _process_page_meta(self) -> bool:
424424
def _read_page_header(self):
425425
bit_offset = self._page_bit_offset
426426
tx = const.page_type_offset + bit_offset
427-
self._current_page_type = self._read_int(tx, const.page_type_length)
427+
self._current_page_type = (
428+
self.read_int(tx, const.page_type_length) & const.page_type_mask
429+
)
428430
tx = const.block_count_offset + bit_offset
429431
self._current_page_block_count = self._read_int(tx, const.block_count_length)
430432
tx = const.subheader_count_offset + bit_offset

pandas/io/sas/sas_constants.py

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
block_count_length = 2
5454
subheader_count_offset = 4
5555
subheader_count_length = 2
56+
page_type_mask = 3840
5657
page_meta_type = 0
5758
page_data_type = 256
5859
page_amd_type = 1024

0 commit comments

Comments
 (0)