We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
>>> df0 = pd.DataFrame({}, columns=['A']) >>> df1 = pd.DataFrame({'A': []}) >>> df0.columns Index(['A'], dtype='object') >>> df1.columns Index(['A'], dtype='object') >>> df0.empty True >>> df1.empty True >>> df0['A'] Series([], Name: A, dtype: object) >>> df1['A'] Series([], Name: A, dtype: float64)
The dtype of df0['A'] and df1['A'] differ (object vs float64) which is confusing and can lead to subtle bugs.
df0['A']
df1['A']
object
float64
The dtype of df0['A'] and df1['A'] should match.
pd.show_versions()
commit: None python: 3.7.0.final.0 python-bits: 64 OS: Linux OS-release: 4.18.9-arch1-1-ARCH machine: x86_64 processor: byteorder: little LC_ALL: None LANG: en_GB.utf8 LOCALE: en_GB.UTF-8
pandas: 0.23.4 pytest: None pip: None setuptools: 40.4.3 Cython: 0.28.5 numpy: 1.15.1 scipy: 1.1.0 pyarrow: None xarray: None IPython: 6.5.0 sphinx: 1.8.0 patsy: None dateutil: 2.7.3 pytz: 2018.5 blosc: None bottleneck: None tables: None numexpr: None feather: None matplotlib: 2.2.3 openpyxl: None xlrd: None xlwt: None xlsxwriter: None lxml: None bs4: None html5lib: None sqlalchemy: 1.2.11 pymysql: None psycopg2: None jinja2: 2.10 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None
The text was updated successfully, but these errors were encountered:
Strange they would be different but also tough to reason about which one is correct or not - how do you expect this to be handled?
Sorry, something went wrong.
My guess is that this is a manifestation of #17261 and that defaulting to object dtype would be the correct behavior here.
Makes sense. I think this is a duplicate then so closing as such but feel free to reopen if anyone disagrees
Ah, thanks - searched for something before opening this, but just not with the right terms...
No branches or pull requests
Code Sample, a copy-pastable example if possible
Problem description
The dtype of
df0['A']
anddf1['A']
differ (object
vsfloat64
) which is confusing and can lead to subtle bugs.Expected Output
The dtype of
df0['A']
anddf1['A']
should match.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.0.final.0
python-bits: 64
OS: Linux
OS-release: 4.18.9-arch1-1-ARCH
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: en_GB.utf8
LOCALE: en_GB.UTF-8
pandas: 0.23.4
pytest: None
pip: None
setuptools: 40.4.3
Cython: 0.28.5
numpy: 1.15.1
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.5.0
sphinx: 1.8.0
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: 1.2.11
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: