diff --git a/pandas/_libs/writers.pyx b/pandas/_libs/writers.pyx index 73201e75c3c88..e841ff7819347 100644 --- a/pandas/_libs/writers.pyx +++ b/pandas/_libs/writers.pyx @@ -107,7 +107,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 bb5bce96bc64b..2a6a7089d77fb 100644 --- a/pandas/io/sas/sas.pyx +++ b/pandas/io/sas/sas.pyx @@ -436,7 +436,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