
Compare lists and NumPy arrays for vectorized arithmetic across many values, highlighting axis-based indexing, memory efficiency, and seamless interaction with lists, tuples, and other data structures through broadcasting.
Explore numpy array basics by creating one-dimensional, two-dimensional, and three-dimensional arrays with np.array, np.arange, and np.random.randint; inspect size, ndim, shape, and dtype.
Learn 3d array indexing and slicing with a 60-point 2018–2020 sales dataset across five products, reshaping a 1d array into 3d and extracting subsets by axis.
Compare performance of adding a value to a list versus a numpy array using the time module and %timeit, showing numpy faster and offering insights into average times and standard deviations.
Use numpy.where to replace negative values in column B with zeros, creating a new variable C, and explore its behavior on dataframes of varying sizes.
Compare numpy.where and apply lambda by building a dummy DataFrame and generating a 1/0 flag, then time both methods with the time module to contrast performance.
Apply np.select() to floor and cap outliers in a DataFrame column, setting negatives to 0 and values above 100 to 100. Compare with np.where and extend to multiple variables.
Use numpy's np.select to map grocery items to product categories with a dictionary-based approach and isin conditions on a DataFrame, replacing unknown with a default label.
Learn array broadcasting across 2d and 3d arrays and its rules. Apply it to dataframe arithmetic, with numpy select for flooring and capping, and compare to cross-join alternatives.
Explore applying flooring and capping with different thresholds via numpy broadcasting on a subset of variables in a data frame, using threshold lists and conditional masks.
The course covers three key areas in Numpy:
Numpy Arrays as Data Structures - Developing an in-depth understanding along the lines of:
Intuition of Arrays as Data Containers
Visualizing 2D/3D and higher dimensional Arrays
Array Indexing and Slicing - 2D/3D Arrays
Performing basic/advanced operations using Numpy Arrays
Useful Numpy Functions - Basic to Advanced usage of the below Numpy functions and how they perform compared to their counterpart methods
numpy where() function
Comparison with Apply + Lambda
Performance on Large DataFrames
Varied uses in new variable creation
numpy select() function
Apply conditions on single and multiple numeric variables
Apply conditions on categorical variable
Array Broadcasting - Developing an intuition of "How Arrays with dissimilar shapes interact" and how to put it to use
Intuition of Broadcasting concept on 2D/3D Arrays
Under what scenarios can we use Broadcasting to replace some of the computationally expensive methods like For loops and Cross-join Operations, etc. especially when working on a large Datasets
The course also covers the topic - "How to time your codes/processes", which will equip you to:
Track time taken by any code block (using Two different methods) and also apply to your own processes/codes
Prepare for the upcoming Chapter "Useful Numpy Functions", where we not only compare performance of Numpy functions with other conventionally used methods but also monitor how they perform on large Datasets