jagmit sandhu wrote:
> python newbie. I can't understand the following about numpy arrays:
>
> x = np.array([[0, 1],[2,3],[4,5],[6,7]])
> x
> array([[0, 1],
>[2, 3],
>[4, 5],
>[6, 7]])
> x.shape
> (4, 2)
> y = x[:,0]
> y
> array([0, 2, 4, 6])
> y.shape
> (4,)
>
> Why is t
Il giorno giovedì 2 aprile 2020 06:30:22 UTC+2, jagmit sandhu ha scritto:
> python newbie. I can't understand the following about numpy arrays:
>
> x = np.array([[0, 1],[2,3],[4,5],[6,7]])
> x
> array([[0, 1],
>[2, 3],
>[4, 5],
>[6, 7]])
> x.shape
> (4, 2)
> y = x[:,0]
> y
python newbie. I can't understand the following about numpy arrays:
x = np.array([[0, 1],[2,3],[4,5],[6,7]])
x
array([[0, 1],
[2, 3],
[4, 5],
[6, 7]])
x.shape
(4, 2)
y = x[:,0]
y
array([0, 2, 4, 6])
y.shape
(4,)
Why is the shape for y reported as (4,) ? I expected it to be a