What does the c underscore expression `c_` do exactly?

后端 未结 6 1950
长情又很酷
长情又很酷 2020-12-12 14:23

It seems to be some kind of horizontal concatenation, but I could not find any documentation online. Here a minimal working example:

In [1]: from numpy impo         


        
6条回答
  •  一生所求
    2020-12-12 15:06

    np.c_[[1,4,5,4,5,3],[1,4,2,4,5,3],[2,4,6,8,9,0]]..This Concats The Arrays Horizontal or Say By Axis 0.So The Array Will be

    array([[1, 1, 2],
           [4, 4, 4],
           [5, 2, 6],
           [4, 4, 8],
           [5, 5, 9],
           [3, 3, 0]])
    

    To Determine The Rows, Total Elements/Total no Of Arrays

    (i.e 18/3) [{len([1,4,5,4,5,3])}+{len([1,4,5,4,5,3])}+{len([2,4,6,8,9,0])}]//len([[1,4,5,4,5,3],[1,4,2,4,5,3],[2,4,6,8,9,0]])

    So The Aboove One Gives 6..SO 6 rows will be there.

    For No of Colums, Total Elements/len(any one array inside the array)

    for eg 18/len([1,4,5,4,5,3])

    So The Columns will be 18/6 and That is 3.

提交回复
热议问题