How to convert ndarray to array?

An alternative is to use np.ravel:

>>> np.zeros((3,3)).ravel()
array([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.])

The importance of ravel over flatten is ravel only copies data if necessary and usually returns a view, while flatten will always return a copy of the data.

To use reshape to flatten the array:

tt = t.reshape(-1)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)