Closed
Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
import locale
locale.setlocale(locale.LC_ALL, "zh_CN")
p = pd.Period("2018-03-11 13:00", freq="H")
print(p.strftime("%p")) # UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcf ...
Issue Description
Period.strftime("%p")
prints the locale-specific version of AM or PM. When the locale uses a non-utf8 compliant encoding, it crashes.
This bug does not happen with others, for example Timestamp.strftime
.
Expected Behavior
No error, printing the actual string representing AM or PM
Installed Versions
This is on the main
branch head