Open
Description
I'm running into an error using matmul with single dimension pandas data frames. The below code worked as expected in 1.15.4 but after I upgraded to 1.16.3 I get the below error message. matmul works if I convert the data frames to numpy arrays but could previously handle the data frames.
Reproducing code example:
import pandas as pd
import numpy as np
d = {'col1': [0.0037448, -0.002455324, 0.003062666, 0.000768503, 0.002309015]}
df = pd.DataFrame(data=d)
dfT = df.T
np.matmul(dfT, df)
Error message:
Traceback (most recent call last):
File "MatmulBugTest.py", line 8, in <module>
np.matmul(dfT, df)
File "C:\Users\bryant_n\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\generic.py", line 1909, in __array_wrap__
return self._constructor(result, **d).__finalize__(self)
File "C:\Users\bryant_n\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\frame.py", line 424, in __init__
copy=copy)
File "C:\Users\bryant_n\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\internals\construction.py", line 167, in init_ndarray
return create_block_manager_from_blocks([values], [columns, index])
File "C:\Users\bryant_n\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\internals\managers.py", line 1660, in create_block_manager_from_blocks
construction_error(tot_items, blocks[0].shape[1:], axes, e)
File "C:\Users\bryant_n\AppData\Local\Continuum\anaconda3\lib\site-packages\pandas\core\internals\managers.py", line 1691, in construction_error
passed, implied))
ValueError: Shape of passed values is (1, 1), indices imply (1, 5)
Numpy/Python version information:
1.16.3 3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]