-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Transpose construction/block error with certain dtypes #16362
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
This also repros with direct construction pd.DataFrame(np.array([[pd.NaT, 'a', 'b', 0],
[pd.NaT, 'b', 'c', 1]]))
# IndexError: tuple index out of range But doesn't if only one string column pd.DataFrame(np.array([[pd.NaT, 'a', 0],
[pd.NaT, 'b', 1]]))
# fine! |
I see some inconsistency in the |
@RobinFiveWords - easiest to review if you would submit a PR with that change - main thing will be that existing tests still pass. |
closes pandas-dev#16362 Author: RobinFiveWords <[email protected]> Closes pandas-dev#16395 from RobinFiveWords/cast-infer-datetime-reshape-fix and squashes the following commits: 7ad1e7d [RobinFiveWords] redid lost changes to cast.py and test_cast.py afa2eeb [RobinFiveWords] added whatsnew0.20.2 entry 7a35624 [RobinFiveWords] removed whatsnew entry again 2ec60a6 [RobinFiveWords] added back whatsnew change (cherry picked from commit 05d0667)
closes #16362 Author: RobinFiveWords <[email protected]> Closes #16395 from RobinFiveWords/cast-infer-datetime-reshape-fix and squashes the following commits: 7ad1e7d [RobinFiveWords] redid lost changes to cast.py and test_cast.py afa2eeb [RobinFiveWords] added whatsnew0.20.2 entry 7a35624 [RobinFiveWords] removed whatsnew entry again 2ec60a6 [RobinFiveWords] added back whatsnew change (cherry picked from commit 05d0667)
closes pandas-dev#16362 Author: RobinFiveWords <[email protected]> Closes pandas-dev#16395 from RobinFiveWords/cast-infer-datetime-reshape-fix and squashes the following commits: 7ad1e7d [RobinFiveWords] redid lost changes to cast.py and test_cast.py afa2eeb [RobinFiveWords] added whatsnew0.20.2 entry 7a35624 [RobinFiveWords] removed whatsnew entry again 2ec60a6 [RobinFiveWords] added back whatsnew change
Code Sample, a copy-pastable example if possible
Problem description
Tried to provide a minimal example here. I originally encountered the error with a dataframe containing datetime, object, and int dtypes, and triggered it with this...
df.iloc[[0, -1]].T
...and even found things like this:
Expected Output
dt1 NaT NaT
obj1 a b
obj2 c d
obj3 e f
num1 0 1
0 1
dt1 NaT NaT
obj1 a b
obj2 c d
obj3 e f
num1 0 1
Output of
pd.show_versions()
pandas: 0.20.1
pytest: 3.0.5
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.25.2
numpy: 1.12.1
scipy: 0.19.0
xarray: None
IPython: 5.1.0
sphinx: 1.5.1
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2016.10
blosc: None
bottleneck: 1.2.0
tables: 3.2.2
numexpr: 2.6.2
feather: None
matplotlib: 2.0.1
openpyxl: 2.4.1
xlrd: 1.0.0
xlwt: 1.2.0
xlsxwriter: 0.9.6
lxml: 3.7.2
bs4: 4.5.3
html5lib: None
sqlalchemy: 1.1.5
pymysql: None
psycopg2: None
jinja2: 2.9.4
s3fs: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: