Category: Data Wrangling
-
Change elements of an array based on a condition using np.where
Let’s say we want to convert multiple categorical variables into binary variables by selecting one category as “0” and the rest as “1”. Or we want to change the values of an array based on a condition, such as in RELU function where all negative values are converted to zero and rest stay the same.…
-
Join two or more arrays using `numpy.concatenate`
np.concatenate is used for concatenating numpy arrays.We will discuss here some of the functionalities of this method of numpy arrays.It takes a list of two or more arrays as input argument, and some other keyword arguments, one of which we will cover here. Simplest usage of the concatenate method is as follows: Python Both of the inputs in…