10000 REGR: Series.str.encode("base64") by simonjayhawkins · Pull Request #32080 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

REGR: Series.str.encode("base64") #32080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
REGR: Series.str.encode("base64")
  • Loading branch information
simonjayhawkins committed Feb 18, 2020
commit 3feb7e37db3806af076f263dd4c6cecc97ae685e
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.0.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Fixed regressions
- Fixed regression in :meth:`Series.align` when ``other`` is a DataFrame and ``method`` is not None (:issue:`31785`)
- Fixed regression in :meth:`pandas.core.groupby.RollingGroupby.apply` where the ``raw`` parameter was ignored (:issue:`31754`)
- Fixed regression in :meth:`rolling(..).corr() <pandas.core.window.Rolling.corr>` when using a time offset (:issue:`31789`)
-
- Fixed regression in :meth:`Series.str.encode` where ``base64`` was no longer valid for bytes objects (:issue:`32048`)

.. ---------------------------------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2898,7 +2898,6 @@ def decode(self, encoding, errors="strict"):
return self._wrap_result(result, returns_string=False)

@copy(str_encode)
@forbid_nonstring_types(["bytes"])
def encode(self, encoding, errors="strict"):
result = str_encode(self._parent, encoding, errors)
return self._wrap_result(result, returns_string=False)
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/test_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3592,3 +3592,11 @@ def test_string_array_extract():

result = result.astype(object)
tm.assert_equal(result, expected)


def test_bytes_encode():
# gh-32049
ser = pd.Series(list("abc"))
result = ser.str.encode(encoding="utf-8").str.encode(encoding="base64")
expected = pd.Series([b"YQ==\n", b"Yg==\n", b"Yw==\n"])
tm.assert_series_equal(result, expected)
0