
Explore the numpy library for numerical python, covering array creation and manipulation, arithmetic and statistical operations, linear algebra, and practical setup with anaconda and spyder.
Learn how NumPy arrays enable vectorized operations and broadcasting to apply arithmetic to all elements, outperforming lists and interacting with lists through efficient, C-backed optimization.
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 to reshape numpy arrays from 1D to 2D or 3D using reshape and the shape attribute. Use -1 for inference and ensure element counts match.
Learn how NumPy arrays act as data containers by tracking quarterly sales for three products across years, using two-dimensional and three-dimensional arrays to label quarters, products, and years.
Learn how numpy arrays act as data containers by modeling quarterly sales for three products in 2d arrays, then extend to a 3d array using reshape.
Visualize two-dimensional, three-dimensional, and higher dimensional arrays by understanding axes, axis 0, axis 1, and axis 2, shapes, and indexing, using intuitive analogies like floors and buildings to master Numpy.
Learn how axes govern indexing in arrays of different dimensions, and practice 1-D and 2-D slicing rules, including start and end omissions, colon ranges, and selecting discrete indices.
Explore numpy array slicing on a 2-D array by axis 0 and axis 1 to fetch product sales across quarters using ranges and discrete indices.
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.
Explore how axis choices affect basic operations on 2-D arrays in NumPy, including sum, min, argmin, and boolean comparisons to analyze revenue data across products and quarters.
Learn how to time the code and measure performance for Numpy arrays and Numpy functions, compare against Python lists, and explore binning on data frames of varying sizes.
Compare two popular Python timing methods—the time module and the %timeit magic—to measure code execution, interpret start and end times, and evaluate performance across varying dataframe sizes.
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.
compare four binning methods for a numeric variable using pandas and numpy, measure performance with %timeit on growing dataframes, and confirm numpy digitize is fastest with consistent outputs.
Explore numpy where and numpy select for data manipulation, compare performance with apply and lambda on large dataframes, and handle single and multiple numeric variables with categorical criteria.
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.
Compare np.where() and Apply Lamda performance on dataframes of increasing size, showing np.where() outperforms Apply Lamda, using a custom function to measure t1 and t2 and plot with matplotlib.
Explore seven practical np.where() applications on medical data, from labeling by age and multi-condition flags to missing value imputation and currency-based computations.
Apply np.select() to arrays and dataframes by mapping multiple conditions to corresponding choices, with a default value of zero, to overwrite values with 10, 20, and 30.
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.
Demonstrates flooring and capping on multiple DataFrame columns with np.select, using .loc to subset B, C, and E, and creating new variables for the results.
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 numpy broadcasting with 4x3 arrays, showing one-to-one interactions for equal shapes and one-to-many interactions when shapes differ, including scalars, 1d, and 2d inputs, and the broadcasting rules.
Learn broadcasting rules for a two-dimensional array as it interacts with similarly shaped arrays, using reshape and range-based one-dimensional arrays on a six by four grid.
Learn practical numpy broadcasting in python to perform operations on multiple data frame columns, including currency conversion with exchange rates and computing proportional sales across months.
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.
Compute percentage concordance for a logistic regression model by comparing probability scores of responders versus nonresponders. Use broadcasting instead of cross joins to speed up analysis on large data frames.
Explore broadcasting intuition in NumPy through a 3D array example, showing how five points with x and y coordinates interact with a second set to produce 3D outputs.
Explore Python NumPy broadcasting to compute pairwise coordinate differences, square them, sum to distances, and use argmin to identify the closest centroid for each point.
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