Bug#923708: pandas: np.array @ Series acts the wrong way round

Rebecca N. Palmer rebecca_palmer at zoho.com
Mon Mar 4 07:57:57 GMT 2019


Source: pandas
Version: 0.23.3+dfsg-2
Severity: important
Control: tags -1 fixed-upstream patch

np.array @ Series actually calculates Series @ np.array, which is an 
error for nonsquare matrices and a *wrong answer* for square matrices.

Fixed upstream by 
https://github.com/pandas-dev/pandas/pull/21578/commits/95d66f0e17c12a1ad661ad68c4fb49eadcf4b578

a= np.array([[ 0, -1, -2, -3, -4, -5, -6, -7, -8, -9],
        [ 1,  0, -1, -2, -3, -4, -5, -6, -7, -8],
        [ 2,  1,  0, -1, -2, -3, -4, -5, -6, -7],
        [ 3,  2,  1,  0, -1, -2, -3, -4, -5, -6],
        [ 4,  3,  2,  1,  0, -1, -2, -3, -4, -5],
        [ 5,  4,  3,  2,  1,  0, -1, -2, -3, -4],
        [ 6,  5,  4,  3,  2,  1,  0, -1, -2, -3],
        [ 7,  6,  5,  4,  3,  2,  1,  0, -1, -2],
        [ 8,  7,  6,  5,  4,  3,  2,  1,  0, -1],
        [ 9,  8,  7,  6,  5,  4,  3,  2,  1,  0]])
b=pd.Series(np.arange(10))
a at b

array([ 285,  240,  195,  150,  105,   60,   15,  -30,  -75, -120])

pd.DataFrame(a)@b

0   -285
1   -240
2   -195
3   -150
4   -105
5    -60
6    -15
7     30
8     75
9    120
dtype: int64



More information about the debian-science-maintainers mailing list