-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: uint8 silently converted to int8 during dataframe creation #43733
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
Comments
Could you provide a more minimal reproducible example? https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports The example should ideally not depend of skimage such that if this is an issue we can run this example in our testing suite |
@mroeschke I have updated to only rely on |
I have hit upon this in Pandas 1.4.3: import numpy as np
import pandas as pd
a = np.uint16(32800)
s = pd.Series(a)
assert a == s[0] where I though it might be due to it being a scalar being passed in, not a sequence but If I change it so that it takes a list: a = [np.uint16(32800)]
s = pd.Series(a)
assert a[0] == s[0] then the dtype is still But, if I pass it as a numpy array: a = np.array([np.uint16(32800)]) # or equally: a = np.array([32800], dtype=np.uint16)
s = pd.Series(a)
assert a[0] == s[0] then it works correctly with Finally, if I use |
I've just checked the |
I think this was solved by #47475 which will be apart of the 1.5 release, so closing |
Uh oh!
There was an error while loading. Please reload this page.
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 master branch of pandas.
Reproducible Example
Issue Description
Apologies if this issue already exists -- type-related issues are hard for me to navigate in github since there are too many to easily parse.
uint8
subarray dtypes are silently converted toint8
when constructing a dataframe from lists.I tried testing on master but Windows has a build error for me (stack trace below),
Expected Behavior
The dtype of each unit in each column is a
uint8
, so I would expectuint8
resulting columnsInstalled Versions
INSTALLED VERSIONS
commit : 73c6825
python : 3.9.4.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 1.3.3
numpy : 1.19.5
pytz : 2021.1
dateutil : 2.8.1
pip : 21.1.3
setuptools : 52.0.0.post20210125
Cython : None
pytest : 6.2.4
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.4.3
lxml.etree : 4.6.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.0.1
IPython : 7.23.1
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.4.2
numexpr : None
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.6.3
sqlalchemy : 1.4.15
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: