diff --git a/pandas/_libs/writers.pyx b/pandas/_libs/writers.pyx index 091d76df26a17..2d5b31d7ccbcf 100644 --- a/pandas/_libs/writers.pyx +++ b/pandas/_libs/writers.pyx @@ -112,7 +112,7 @@ def convert_json_to_lines(arr: object) -> str: if not in_quotes: num_open_brackets_seen -= 1 - return narr.tostring().decode('utf-8') + return narr.tobytes().decode('utf-8') # stata, pytables diff --git a/pandas/io/sas/sas.pyx b/pandas/io/sas/sas.pyx index 11171af1e0c82..0038e39e2ffcc 100644 --- a/pandas/io/sas/sas.pyx +++ b/pandas/io/sas/sas.pyx @@ -431,7 +431,7 @@ cdef class Parser: elif column_types[j] == column_type_string: # string string_chunk[js, current_row] = np.array(source[start:( - start + lngt)]).tostring().rstrip(b"\x00 ") + start + lngt)]).tobytes().rstrip(b"\x00 ") js += 1 self.current_row_on_page_index += 1