Skip to content

Commit 2b06110

Browse files
committed
Speedup
1 parent 5e3d0ed commit 2b06110

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
@@ -426,8 +426,10 @@ cdef class Parser:
426426
jb += 1
427427
elif column_types[j] == column_type_string:
428428
# string
429-
string_chunk[js, current_row] = np.array(source[start:(
430-
start + lngt)]).tobytes().rstrip(b"\x00 ")
429+
# Skip trailing whitespace
430+
while lngt > 0 and source[start+lngt-1] in b"\x00 ":
431+
lngt -= 1
432+
string_chunk[js, current_row] = source[start:start+lngt]
431433
js += 1
432434

433435
self.current_row_on_page_index += 1

0 commit comments

Comments
 (0)