BUG: \0 null bytes in str
not preserved in pandas.CategoricalIndex
or pandas.MultiIndex
#61189
Closed
3 tasks done
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
Issue Description
When constructing a
pandas.CategoricalIndex
orpandas.MultiIndex
from Pythonstr
values, any code points following a '\0' are discarded. This does not occur withbytes
inputs.Expected Behavior
The null bytes should be preserved exactly.
Installed Versions
INSTALLED VERSIONS
commit : b64f438
python : 3.13.2
python-bits : 64
OS : Linux
OS-release : 6.12.20-1-lts
Version : #1 SMP PREEMPT_DYNAMIC Sun, 23 Mar 2025 08:02:10 +0000
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 3.0.0.dev0+2028.gb64f438cc8
numpy : 2.3.0.dev0+git20250325.2a6f4f0
dateutil : 2.9.0.post0
pip : 24.3.1
tzdata : 2025.2
The text was updated successfully, but these errors were encountered: