Skip to content

Commit 0783757

Browse files
committed
BUG: Make sure that sas7bdat parsers memory is initialized to 0 (pandas-dev#21616)
Memory for numbers in sas7bdat-parsing was not initialized properly to 0. For sas7bdat files with numbers smaller than 8 bytes this made the least significant part of the numbers essentially random. Fix it by initializing memory correctly.
1 parent 0976e12 commit 0783757

File tree

5 files changed

+407
-2
lines changed

5 files changed

+407
-2
lines changed

doc/source/whatsnew/v0.24.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ I/O
734734
- :func:`read_html()` no longer ignores all-whitespace ``<tr>`` within ``<thead>`` when considering the ``skiprows`` and ``header`` arguments. Previously, users had to decrease their ``header`` and ``skiprows`` values on such tables to work around the issue. (:issue:`21641`)
735735
- :func:`read_excel()` will correctly show the deprecation warning for previously deprecated ``sheetname`` (:issue:`17994`)
736736
- :func:`read_csv()` will correctly parse timezone-aware datetimes (:issue:`22256`)
737-
-
737+
- :func:`read_sas()` will parse numbers in sas7bdat-files that have width less than 8 bytes correctly. (:issue:`21616`)
738738

739739
Plotting
740740
^^^^^^^^

pandas/io/sas/sas7bdat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ def read(self, nrows=None):
614614
ns = (self.column_types == b's').sum()
615615

616616
self._string_chunk = np.empty((ns, nrows), dtype=np.object)
617-
self._byte_chunk = np.empty((nd, 8 * nrows), dtype=np.uint8)
617+
self._byte_chunk = np.zeros((nd, 8 * nrows), dtype=np.uint8)
618618

619619
self._current_row_in_chunk_index = 0
620620
p = Parser(self)

0 commit comments

Comments
 (0)