Pandas version checks
-
[X] I have checked that this issue has not already been reported.
-
[X] I have confirmed this bug exists on the latest version of pandas.
-
[X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
[ins] In [3]: pd.DataFrame({"a": np.array([b'abc'], dtype="S3")}).iloc[:, 0].dtype
Out[3]: dtype('O')
[ins] In [4]: foo = pd.DataFrame(); foo['a'] = np.array([b'abc'], dtype="S3"); foo['a'].dtype
Out[4]: dtype('S3')
Issue Description
The same numpy should have the same dtypes when turned into a pandas series through different approaches, but they are differnt. The 'S3' dtype is harder to deal with because things like df.select_dtype(object) don't work.
Expected Behavior
The best case is that both should be object dtype. Barring that, having them be the same dtype would be nice.
Installed Versions
INSTALLED VERSIONS
------------------
commit : 66e3805b8cabe977f40c05259cc3fcf7ead5687d
python : 3.8.13.final.0
python-bits : 64
OS : Linux
OS-release : 4.18.0-348.23.1.el8_5.x86_64
Version : #1 SMP Tue Apr 12 11:20:32 EDT 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.5
numpy : 1.23.3
pytz : 2022.4
dateutil : 2.8.2
pip : 22.2.2
setuptools : 65.4.1
Cython : 0.29.32
pytest : 7.0.1
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.8.0
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.5.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : 1.3.5
fsspec : 2022.8.2
fastparquet : None
gcsfs : None
matplotlib : 3.6.0
numexpr : 2.8.3
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : 9.0.0
pyxlsb : None
s3fs : None
scipy : 1.9.1
sqlalchemy : 1.4.41
tables : 3.6.1
tabulate : 0.9.0
xarray : 2022.9.0
xlrd : 2.0.1
xlwt : None
numba : 0.56.2
Comment From: phofl
Hi, thanks for your report. We should never end up with S3 or similar, but this is a know issue. Could you double check the issue tracker?
Comment From: zbs
I searched for is:issue series bytes dtype and is:issue series s dtype, but couldn't find anything.