I'm trying convert numpy array of shape (80000,)
to (80000,55)
I'm having the data like below [[1212,121,121],[12,122,111]]
After convert this list of list I'm getting the shape of (2,)
but I wanna have shape like (2,3)
how to do it.
In [68]: np.array([[1212,121,121],[12,122,111]] )
Out[68]:
array([[1212, 121, 121],
[ 12, 122, 111]])
In [69]: _.shape
Out[69]: (2, 3)
If you are getting a shape like (2,), it's probably because some of the nested lists differ in shape. Check the dtype
as well as the shape
. Look at the array as well.
In [70]: np.array([[1212,121,121],[12,122,111,3]] )
Out[70]: array([list([1212, 121, 121]), list([12, 122, 111, 3])], dtype=object)
An upcoming version will add a warning:
/usr/local/bin/ipython3:1: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray
#!/usr/bin/python3
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.