Skip to content

Commit 29478a1

Browse files
committed
Speedup
1 parent 9c241fe commit 29478a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pandas/io/sas/sas.pyx

+4-2
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,10 @@ cdef class Parser:
427427
jb += 1
428428
elif column_types[j] == column_type_string:
429429
# string
430-
string_chunk[js, current_row] = np.array(source[start:(
431-
start + lngt)]).tobytes().rstrip(b"\x00 ")
430+
# Skip trailing whitespace
431+
while lngt > 0 and source[start+lngt-1] in b"\x00 ":
432+
lngt -= 1
433+
string_chunk[js, current_row] = source[start:start+lngt]
432434
js += 1
433435

434436
self.current_row_on_page_index += 1

0 commit comments

Comments
 (0)