Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert multidimentional numpy array to string and back

In [184]: a=np.arange(12).reshape(3,4)

In [185]: np.fromstring(a.tostring(),int)
Out[185]: array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11])

In [186]: np.fromstring(a.tostring(),a.dtype).reshape(a.shape)
Out[186]: 
array([[ 0,  1,  2,  3],
       [ 4,  5,  6,  7],
       [ 8,  9, 10, 11]])
Comment

PREVIOUS NEXT
Code Example
Python :: bucket dataframe into ranges 
Python :: Using rstrip() method to remove the newline character from a string 
Python :: List Get a Element-2 
Python :: dont show certain legend labels 
Python :: List Method: list append vs extend 
Python :: draw line in markdown 
Python :: print 1 side of a dictionary python 
Python :: python interface kenee 
Python :: python sns save plot lable axes 
Python :: what is fourier transform in python 
Python :: print out python 
Python :: unhapppy man with monwy 
Python :: how to make a relationship in python 
Python :: using rlike in pyspark for numeric 
Python :: dice rolling app in python 
Python :: how to capture multiple screens with ImageGrab 
Python :: youtube view bot python code pastebin 
Python :: Loop per n (batch) 
Python :: python on_mouse_down/collidepoint 
Python :: how to make an infinite loop in python 
Python :: how to convert array value to integer in python 
Python :: ladnha; 
Python :: first n lis tpython 
Python :: creating a new DataFrame from itertuples, namedtuple using a series or list() 
Python :: Tuples as return values 
Python :: pydictionary 
Python :: how to multiply two lists in python 
Python :: python tupel from string 
Python :: filter pandas stack overflow 
Python :: violajones python opencv 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =