Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy aray map values with dictionary

>>> a = np.array([[1,2,3],
              [3,2,4]])
>>> my_dict = {1:23, 2:34, 3:36, 4:45}
>>> np.vectorize(my_dict.get)(a)
array([[23, 34, 36],
       [36, 34, 45]])
Comment

PREVIOUS NEXT
Code Example
Python :: increase axis ticks pyplot 
Python :: django in conda 
Python :: How to join two dataframes by 2 columns so they have only the common rows? 
Python :: python run command 
Python :: django response headers 
Python :: select columns to include in new dataframe in python 
Python :: opencv google colab 
Python :: selenium save webpage as pdf python 
Python :: difference between set and tuple in python 
Python :: nltk remove more stopwords 
Python :: (for in) printing in python 
Python :: python code with sigma 
Python :: Python Changing Directory 
Python :: end python print with space 
Python :: sqlalchemy filter between dates 
Python :: python thread function 
Python :: How to create DataFrames 
Python :: escape character in python 
Python :: find min and max from dataframe column 
Python :: How to rotate the 2D vector by degree in Python: 
Python :: make an android app with python 
Python :: Compute the 2d histogram of x and y. 
Python :: get requests python 
Python :: python program to print ASCII characters in lowercase 
Python :: python sort dict by value 
Python :: python string format 
Python :: how to sort dict by value 
Python :: euclidean algorithm recursive python 
Python :: python last n list elements 
Python :: flask login 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =