Find and count Numpy array frequency of unique row and column values

This short recipe will guide us through identifying and counting unique values in a Numpy array (Ndarray) Creating our NumPy ndarrays We’ll first a couple of Numpy arrays for use to use in our examples. Using numpy.unique() to count Numpy unique array values Run the following code: We’ll get a new array showing the distinct …

Read moreFind and count Numpy array frequency of unique row and column values

Pandas: select multiple columns in a dataframe based on value / condition / index

In today’s recipe we’ll learn how you can subset a DataFrame by selecting multiple columns. Preparations We’ll first create a simple DataFrame that we’ll use throughout the recipe: Here’s our DataFrame quarter person area budget 0 1 Debbie North 43654 1 2 Kim South 35795 2 3 Dorothy West 20860 3 4 Tim Midwest 25390 …

Read morePandas: select multiple columns in a dataframe based on value / condition / index