Numpy pandas visualization

108 terms, defined in plain English with an example each.

All 32 topics

.npy file intermediate

NumPy's binary file format for saving a single array exactly, including its shape and data type, using np.save and np.load. It is much faster and more compact than text files such as CSV, but is meant for NumPy-to-NumPy exchange, and a related .npz format stores several arrays together.

Example. np.save('embeddings.npy', arr) writes a large array to disk; np.load('embeddings.npy') restores it identically.

Related: ndarray, dtype, Memory-mapped array, read_csv

agg intermediate

A pandas method that computes one or more summary statistics for each group or column, such as sum, mean or a custom function. Named output lets you label the output columns, giving a compact and readable summary table.

Example. df.groupby('city').agg(total=('sales', 'sum'), orders=('id', 'count')) returns each city's total sales and order count.

Related: pandas groupby, Reduction, transform, Pivot table

apply intermediate

A pandas method that calls a Python function on each column, each row, or each group of a table. It is flexible but usually much slower than built-in vectorised operations because the function runs one item at a time in Python, so use it only when no vectorised option exists.

Example. df['tier'] = df['spend'].apply(lambda x: 'high' if x > 5000 else 'low') labels customers by spend.

Related: Vectorization, transform, pandas groupby, str accessor

argmax intermediate

A function that returns the position of the largest value in an array rather than the value itself. With an axis argument it does this per row or column. In machine learning it turns a vector of class scores into a predicted class label.

Example. np.argmax([0.1, 0.7, 0.2]) returns 1, so class 1 is the prediction.

Related: argsort, Reduction, Axis, Classification

Array copy intermediate

A new array that owns its own separate memory, created with the copy method or by operations such as fancy indexing. Changes to a copy never touch the original, at the cost of extra memory and time. Use it when you must keep the source data safe.

Example. b = a[:3].copy() gives an independent array; setting b[0] = 99 leaves a unchanged.

Related: Array view, Fancy indexing, Array slicing, ndarray

Array indexing beginner

Reading or changing specific elements of an array by giving their positions in square brackets. Positions start at 0, negative numbers count from the end, and a multi-dimensional array takes one index per axis, separated by commas.

Example. With a = np.array([[10, 20], [30, 40]]), a[1, 0] returns 30 and a[-1, -1] returns 40.

Related: Array slicing, Boolean mask, Fancy indexing, ndarray

Array slicing beginner

Selecting a range of elements with the start:stop:step notation, where the stop position is excluded. On NumPy arrays a slice does not copy data; it returns a view onto the original memory, so changing the slice changes the original array too.

Example. x = np.arange(10); x[2:8:2] returns array([2, 4, 6]) and shares memory with x.

Related: Array indexing, Array view, Array copy, ndarray

Array transpose beginner

Swapping the axes of an array so that rows become columns and columns become rows. In NumPy it is available as the .T attribute and does not move data; it just returns a view with the axes reordered. It is used constantly to align shapes for calculations.

Example. A (2, 3) array a has a.T of shape (3, 2), so element a[0, 2] becomes a.T[2, 0].

Related: Shape, Array view, Reshape, Strides

Array view intermediate

A new array object that looks at the same block of memory as another array instead of holding its own data. Slices and reshapes usually give views. Writing through a view changes the original, which is efficient but can cause surprising side effects.

Example. b = a[:3] makes a view; setting b[0] = 99 also changes a[0] to 99.

Related: Array copy, Array slicing, Reshape, Strides

astype beginner

A pandas method that converts a column to a different data type, such as text to integer or float to category. It is used after loading messy files where numbers arrive as strings, and it raises an error if a value cannot be converted.

Example. df['pincode'] = df['pincode'].astype(str) keeps leading zeros safe by treating pincodes as text.

Related: dtype, Type casting, Categorical dtype, to_datetime

Axes beginner

The single plotting area inside a Matplotlib figure, holding the x and y axis lines, ticks, labels and the drawn data. A figure can contain many of them. Calling plotting methods on this object is the recommended object-oriented style, as it is explicit about where each chart goes.

Example. ax.plot(x, y); ax.set_xlabel('Month') draws a line and labels the horizontal axis on that specific plot area.

Related: Figure, subplots, pyplot, Matplotlib

Axis beginner

A numbered direction along which an array operation is applied. In a 2-D array, axis 0 runs down the rows and axis 1 runs across the columns. Passing an axis to a function such as sum or mean tells it which dimension to collapse, and confusing the two is a very common mistake.

Example. For a marks table of 4 students by 3 subjects, marks.mean(axis=0) returns 3 subject averages, while marks.mean(axis=1) returns 4 student averages.

Related: Reduction, Shape, ndarray, pandas groupby

Bar chart beginner

A chart that represents values for categories as bars whose lengths are proportional to the values. It is best for comparing amounts across separate groups, and the value axis should start at zero so that lengths are not misleading.

Example. A bar for each of five cities showing monthly orders lets you see instantly that Mumbai has the most.

Related: Histogram, Stacked bar chart, Categorical dtype, Pie chart

Binning intermediate

Converting a continuous numeric column into labelled ranges. In pandas, cut makes bins with chosen edges, while qcut makes bins holding roughly equal numbers of rows (quantiles). This is used to make age groups, income bands or risk tiers.

Example. pd.cut(df['age'], [0, 18, 35, 60, 120], labels=['child', 'young', 'adult', 'senior']) assigns each person an age group.

Related: Categorical dtype, value_counts, Histogram, Feature engineering

Boolean indexing beginner

Filtering a DataFrame or Series by passing a True/False condition, so only rows where it is true are kept. Conditions are combined with & (and), | (or) and ~ (not), each wrapped in brackets. It is the pandas counterpart of a SQL WHERE clause.

Example. df[(df['city'] == 'Pune') & (df['sales'] > 1000)] keeps Pune rows with sales above 1000.

Related: loc, Boolean mask, query, DataFrame

Boolean mask beginner

An array of True and False values with the same shape as another array, used to select only the elements where the mask is True. It is built by applying a comparison to the whole array and is the main way to filter numerical data without a loop.

Example. scores[scores > 60] returns only the scores above 60, and (scores > 60).sum() counts how many there are.

Related: Array indexing, np.where, Fancy indexing, Boolean indexing

Box plot intermediate

A compact chart that summarises a distribution with a box from the first to third quartile, a line at the median, and whiskers reaching to typical extremes, with points beyond the whiskers drawn individually as possible outliers. Side by side, it compares groups well.

Example. Box plots of salary for five job levels show how the median and spread rise with level and which individual salaries are unusually high.

Related: Violin plot, Histogram, Outlier, Quartile

Broadcasting intermediate

The rule NumPy uses to combine arrays of different shapes without copying data. Shapes are compared from the last dimension backwards; two dimensions are compatible if they are equal or one of them is 1, and the size-1 dimension is stretched to match. It removes explicit loops and saves memory.

Example. Subtracting a column-means array of shape (3,) from a table of shape (100, 3) works because the means are applied to every one of the 100 rows.

Related: Vectorization, Shape, np.newaxis, Element-wise operation

C order advanced

Row-major memory layout, the NumPy default, in which the elements of each row sit next to each other in memory and the last index changes fastest. Its counterpart, Fortran order, stores columns contiguously. Layout affects iteration speed and how reshape and ravel read elements.

Example. In a C-ordered 2 by 3 array, the memory order is row 0 values first, then row 1 values.

Related: Strides, Ravel, Reshape, ndarray

Categorical dtype intermediate

A pandas data type for a column that takes a limited set of repeated values, such as city or grade. The values are stored once as categories and the column holds small integer codes. It saves memory, speeds up grouping and can carry a meaningful order.

Example. Converting a 10-million-row column of 'Mumbai', 'Delhi' and 'Chennai' with astype('category') cuts its memory use sharply.

Related: dtype, astype, pandas groupby, Nullable dtype

Chunked reading advanced

Loading a large file in pieces of a fixed number of rows instead of all at once, so memory use stays bounded. In pandas, read_csv with a chunksize returns an iterator of DataFrames that you process and combine one at a time.

Example. for chunk in pd.read_csv('logs.csv', chunksize=100000): totals += chunk['bytes'].sum() handles a file too big for RAM.

Related: read_csv, Memory-mapped array, Iterator, DataFrame

Colormap intermediate

A mapping from numeric values to colours, used by heatmaps, scatter plots and maps. Sequential ones run from light to dark for ordered magnitudes, diverging ones have a neutral midpoint for values above and below a centre, and categorical ones give distinct colours to groups. A poor choice can mislead.

Example. Using a diverging colormap centred on zero for a correlation heatmap shows positive and negative values in different hues.

Related: Heatmap, Colour-blind-safe palette, Legend, Matplotlib

Colour-blind-safe palette intermediate

A set of chart colours chosen so that people with the common types of colour vision deficiency can still tell the categories apart. Such palettes vary in lightness as well as hue, and charts should not rely on red versus green alone.

Example. Using blue and orange lines, with different line styles, rather than red and green keeps a chart readable for a colour-blind viewer.

Related: Colormap, Legend, Data-ink ratio, Accessibility

Concatenate beginner

Joining arrays end to end along an existing axis, producing a longer array with the same number of dimensions. All other dimensions must match. NumPy provides a function for this; pandas offers a similar concat for tables.

Example. np.concatenate([[1, 2], [3, 4]]) returns array([1, 2, 3, 4]).

Related: np.stack, pandas concat, Shape, Axis

Copy-on-write advanced

A pandas behaviour in which derived objects appear to be independent copies, but data is actually copied only at the moment one of them is modified. It removes the confusion between views and copies and the related chained-assignment problems, while avoiding needless copying.

Example. Under it, modifying a slice taken from a DataFrame never changes the original table.

Related: SettingWithCopyWarning, Array view, Array copy, DataFrame

crosstab intermediate

A pandas function that counts how often each combination of values from two or more categorical columns occurs, producing a frequency table. It can also normalise counts into proportions. It is a fast way to see relationships between categories.

Example. pd.crosstab(df['gender'], df['bought']) counts buyers and non-buyers for each gender.

Related: Pivot table, value_counts, pandas groupby, Contingency table

Data-ink ratio advanced

A design principle from Edward Tufte that says most of a chart's ink should display data rather than decoration. It encourages removing heavy gridlines, borders, 3-D effects and redundant labels so the message is clear. It is a guide to judgement, not a strict rule.

Example. Removing a chart's background shading, box border and 3-D bars so only the bars and light gridlines remain.

Related: Annotation, Pie chart, Colour-blind-safe palette, Bar chart

DataFrame beginner

Pandas' two-dimensional table of data with labelled rows and named columns. Each column is a Series and can hold its own data type, so numbers, text and dates can sit side by side. It resembles a spreadsheet or a database table and is the central object of data analysis in Python.

Example. pd.DataFrame({'name': ['Asha', 'Ravi'], 'age': [28, 34]}) makes a table with two rows and two columns.

Related: Series, Index, Pandas, loc

DatetimeIndex intermediate

A pandas index made of timestamps. It enables selecting data by date strings or ranges, grouping by periods, and resampling. Most time series work in pandas starts by setting one as the index of a DataFrame.

Example. After df.set_index('date'), df.loc['2026-03'] returns all rows from March 2026.

Related: to_datetime, resample, Index, Time series

describe beginner

A pandas method that prints summary statistics for each numeric column: count, mean, standard deviation, minimum, quartiles and maximum. It gives a quick sense of scale, spread and possible outliers when first exploring a dataset.

Example. df.describe() might show an age column with mean 34, minimum 18 and maximum 240, exposing a data-entry error.

Related: Exploratory data analysis, value_counts, Outlier, DataFrame

drop_duplicates beginner

A pandas method that removes repeated rows, judged on all columns or on a chosen subset, and keeps the first or last occurrence. Duplicate records commonly come from repeated data loads and would otherwise inflate counts and sums.

Example. df.drop_duplicates(subset=['order_id']) keeps one row for each order number.

Related: Data cleaning, DataFrame, value_counts, dropna

dropna beginner

A pandas method that removes rows (or columns) containing missing values. Options let you drop only if all values are missing or if too many are, using how and thresh. It is simple but can discard a lot of data if gaps are common.

Example. df.dropna(subset=['email']) removes only the rows where email is blank.

Related: fillna, Missing data, NaN, DataFrame

dt accessor intermediate

The .dt namespace on a pandas datetime column that extracts parts such as year, month or weekday, and supports date arithmetic and formatting for every value at once. It is used to create calendar features for analysis and models.

Example. df['order_date'].dt.month returns the month number of each order.

Related: to_datetime, str accessor, DatetimeIndex, Feature engineering

dtype beginner

The data type of every element in a NumPy array, such as int64, float32 or bool. It fixes how many bytes each value uses and how the bytes are interpreted. Choosing a smaller type saves memory, while a type that is too small can lose precision or overflow.

Example. np.array([1.5, 2.5], dtype=np.float32).dtype gives float32, so each number takes 4 bytes instead of the 8 bytes of float64.

Related: ndarray, Type casting, NumPy integer overflow, Floating point

einsum advanced

A NumPy function, short for Einstein summation, that expresses multiplications, sums and axis rearrangements of arrays in a compact string such as 'ij,jk->ik'. Repeated letters are multiplied and summed. It replaces many separate transpose and dot calls and is common in deep learning code.

Example. np.einsum('ij,jk->ik', A, B) multiplies two matrices, the same as A @ B.

Related: Matrix multiplication, Tensor, Axis, Broadcasting

Element-wise operation beginner

An operation applied independently to each pair of matching positions in two arrays, or to each element of one array. Arithmetic operators such as + and * behave this way in NumPy. Multiplying two matrices in the linear algebra sense is a different operation.

Example. np.array([1, 2, 3]) * np.array([4, 5, 6]) returns array([4, 10, 18]).

Related: Vectorization, Universal function, Broadcasting, Matrix multiplication

Error bars intermediate

Lines drawn from a plotted point to show the uncertainty or variability of the value, such as a standard deviation or a confidence interval. Without them a chart of averages hides how reliable the averages are. The chart should state what the bars represent.

Example. Bars of average test score for two teaching methods, each with a 95 percent confidence interval, show whether their difference could be chance.

Related: Confidence interval, Bar chart, Standard deviation, Line plot

Fancy indexing intermediate

Selecting array elements by passing a list or array of integer positions instead of a slice. It lets you pick arbitrary elements in any order, or repeat them, and unlike slicing it always returns a new copy of the data rather than a view.

Example. a = np.array([10, 20, 30, 40]); a[[3, 0, 0]] returns array([40, 10, 10]).

Related: Array indexing, Boolean mask, Array copy, Array slicing

Figure beginner

The top-level container in Matplotlib that holds everything in one image: one or more Axes, titles, legends and the overall size. Setting its size and resolution controls how the final picture looks on screen or when saved.

Example. fig = plt.figure(figsize=(8, 4)) creates an empty canvas 8 inches wide and 4 inches tall.

Related: Axes, subplots, Matplotlib, savefig

fillna beginner

A pandas method that replaces missing values with a value you choose, such as zero, the column mean, or the previous value. It is a basic way to impute gaps, but the choice of replacement changes later statistics, so it should suit the data.

Example. df['age'].fillna(df['age'].median()) fills blank ages with the median age.

Related: dropna, Missing data, NaN, Imputation

Heatmap intermediate

A chart that displays a grid of numbers as coloured cells, where colour intensity shows the value. It is widely used for correlation tables, confusion matrices and any two-way summary, and needs a well-chosen colour scale and often printed values in the cells.

Example. A heatmap of the correlation between 10 features shows at a glance which pairs move together.

Related: Colormap, Correlation, Confusion matrix, Seaborn

Histogram beginner

A chart showing how the values of one numeric variable are distributed: the range is cut into equal-width bins and the height of each bar counts the values falling in that bin. It reveals shape, spread, skew and outliers, and the number of bins changes how it looks.

Example. A histogram of 2,000 delivery times in 5-minute bins may show most between 20 and 40 minutes with a long tail beyond 60.

Related: Binning, KDE plot, Box plot, Bar chart

iloc beginner

The pandas accessor that selects rows and columns by integer position, counting from 0, no matter what the labels are. Like Python slicing, it excludes the end position. It is used when the position matters more than the label.

Example. df.iloc[0:3, 1] returns the second column for the first three rows.

Related: loc, Index, Array slicing, DataFrame

KDE plot advanced

A smooth curve that estimates the shape of a distribution by placing a small bump on each data point and adding them up (kernel density estimation). It avoids the choice of bin edges in a histogram, but its smoothness depends on a bandwidth setting.

Example. sns.kdeplot(df['age']) draws a smooth curve of the age distribution, perhaps showing two peaks at 25 and 45.

Related: Histogram, Violin plot, Overplotting, Probability density function

Legend beginner

The key on a chart that explains which colour, line style or marker stands for which series or category. It is created from the labels given to each plotted item and should be placed where it does not hide the data.

Example. ax.plot(x, y1, label='2025'); ax.plot(x, y2, label='2026'); ax.legend() shows which line is which year.

Related: Axes, Colormap, Annotation, Matplotlib

Line plot beginner

A chart that joins data points in order with straight line segments, usually with time or another ordered quantity on the horizontal axis. It shows trends, cycles and changes over time, and can carry several series on one set of axes.

Example. Plotting daily UPI transaction counts over a year as a line shows weekly ups and downs and the overall growth.

Related: Scatter plot, Area chart, Time series, Matplotlib

loc beginner

The pandas accessor that selects rows and columns by their labels. Slices made this way include both end labels, and it also accepts Boolean masks, which makes it the standard tool for filtering rows and setting values safely.

Example. df.loc[df['age'] > 30, 'name'] returns the names of everyone older than 30.

Related: iloc, Boolean indexing, Index, DataFrame

Log scale intermediate

An axis on which equal distances represent equal ratios rather than equal differences, so each step is a multiplication by the same factor. It is used when values span many orders of magnitude, or to make exponential growth appear as a straight line.

Example. Plotting company revenues from 1 crore to 10,000 crore on a log axis keeps both small and large companies visible.

Related: Line plot, Scatter plot, Axes, Exponential growth

Masked array advanced

A NumPy array paired with a Boolean mask that marks some entries as invalid. Calculations such as mean skip the masked entries automatically. It is an alternative to NaN for flagging bad readings, and it works for integer data too, which cannot hold NaN.

Example. A sensor array where -999 means a failed reading can be masked so np.ma.mean ignores those values.

Related: NaN, Boolean mask, Missing data, ndarray

Matplotlib beginner

The foundational Python library for drawing charts. It can produce line plots, bar charts, scatter plots, histograms and much more, with fine control over every element of the figure. Many other plotting libraries, including pandas plotting and Seaborn, are built on top of it.

Example. plt.plot([1, 2, 3], [10, 20, 15]); plt.show() draws a line through three points.

Related: Figure, Axes, Seaborn, pyplot

melt intermediate

A pandas function that reshapes a wide table, with one column per measurement, into a long table with one row per measurement. The old column names go into a single variable column and their values into a value column. Plotting and modelling tools often need this long form.

Example. Melting columns jan, feb and mar into month and sales columns turns a 100-row wide table into 300 long rows.

Related: Tidy data, Pivot table, unstack, DataFrame

Memory-mapped array advanced

An array whose data stays in a file on disk while NumPy reads pieces of it into memory only when they are accessed. It lets you work with datasets larger than the available RAM and share data between processes, at the cost of slower disk access.

Example. np.load('big.npy', mmap_mode='r') lets you slice a 30 GB array on a 16 GB laptop, loading only the parts you touch.

Related: .npy file, ndarray, Array view, Chunked reading

Method chaining intermediate

A style of writing pandas code in which each method returns a new table that is immediately passed to the next method, forming one readable pipeline. It avoids many temporary variables and makes the sequence of cleaning steps easy to follow.

Example. df.dropna().query('age > 18').assign(bmi=lambda d: d.w / d.h**2).sort_values('bmi') filters and derives a column in one expression.

Related: query, assign, SettingWithCopyWarning, DataFrame

Missing data beginner

Values that are absent from a dataset, shown in pandas as NaN, None or NaT. Pandas methods such as isna, fillna and dropna detect and handle them, and most summaries skip them by default. How they are handled directly affects the results of any analysis.

Example. df.isna().sum() counts blank cells per column, for example 12 missing phone numbers out of 500 customers.

Related: NaN, fillna, dropna, Imputation

MultiIndex advanced

An index with two or more levels, so each row is identified by a combination of labels such as country and city. It allows several dimensions of data to be stored in a two-dimensional table and is created by groupby on several keys or set_index with a list.

Example. Sales indexed by (state, year) lets df.loc['Karnataka'] return all years for that state.

Related: Index, pandas groupby, unstack, DataFrame

NaN intermediate

A special floating-point value meaning Not a Number, used for undefined results such as 0/0 or for missing data. It is contagious: arithmetic with it gives NaN, and it is not equal to itself, so it must be tested with np.isnan rather than ==.

Example. np.mean([1, 2, np.nan]) returns nan, whereas np.nanmean ignores the missing entry and returns 1.5.

Related: Missing data, fillna, Floating point, Masked array

ndarray beginner

NumPy's core data structure: a fixed-size grid of values that all share one data type and are stored in one contiguous block of memory. It can have any number of dimensions. Because the layout is uniform, operations run quickly and use far less memory than a Python list of numbers.

Example. np.array([[1, 2, 3], [4, 5, 6]]) creates a two-row, three-column ndarray of integers.

Related: dtype, Shape, Axis, NumPy

np.arange beginner

A NumPy function that builds an array of evenly spaced values from a start up to but not including a stop, moving by a fixed step. It is the array version of Python's range and is handy for indices, labels and quick test data.

Example. np.arange(0, 10, 2) returns array([0, 2, 4, 6, 8]).

Related: np.linspace, ndarray, Array slicing, Vectorization

np.linspace beginner

A NumPy function that produces a chosen number of evenly spaced values between a start and an end value, with the end included by default. You control how many points you get rather than the step size, which makes it the usual way to build x-axes for plots.

Example. np.linspace(0, 1, 5) returns array([0., 0.25, 0.5, 0.75, 1.]).

Related: np.arange, Line plot, ndarray, Vectorization

np.newaxis intermediate

An alias for None that, placed inside an index, inserts a new axis of length 1 into an array. This turns a flat array into a column or row and is the usual way to make shapes line up for broadcasting.

Example. With x of shape (5,), x[:, np.newaxis] has shape (5, 1), so it can be combined with a shape (3,) array to give a (5, 3) result.

Related: Broadcasting, Shape, Reshape, Axis

np.stack intermediate

Joining arrays of identical shape along a brand-new axis, so the result has one more dimension than the inputs. Variants vstack and hstack join vertically or horizontally. It is used to gather many samples into a single batch array.

Example. Stacking three arrays of shape (4,) with np.stack gives one array of shape (3, 4).

Related: Concatenate, Shape, Axis, ndarray

np.where intermediate

A NumPy function that chooses between two values for each element depending on a condition array. With one argument only, it instead returns the positions where the condition is true. It is a vectorised replacement for an if-else inside a loop.

Example. np.where(marks >= 40, 'pass', 'fail') labels every mark in an array as pass or fail in one step.

Related: Boolean mask, Vectorization, argmax, ndarray

np.zeros and np.ones beginner

Functions that create an array of a given shape filled entirely with 0s or 1s. They are used to preallocate space for results, to initialise weights or counters, and to build masks. Companion functions np.full and np.empty do the same with a chosen value or unset memory.

Example. np.zeros((3, 4)) creates a 3 by 4 array of zeros; np.ones(5, dtype=int) creates five integer ones.

Related: ndarray, Shape, dtype, np.arange

NumPy beginner

A Python library for fast numerical work on large grids of numbers. It supplies a typed multi-dimensional array and a large set of functions that operate on whole arrays at once, with the heavy loops running in compiled C code. Most of the Python data and machine learning ecosystem is built on top of it.

Example. Adding two lists of a million marks with a Python loop is slow; converting them to NumPy arrays and writing a + b does the same job in a few milliseconds.

Related: ndarray, Vectorization, Pandas, Broadcasting

NumPy integer overflow advanced

An error that occurs when an integer calculation produces a value too large for its fixed-size type, so the result wraps around. NumPy integers have fixed widths and usually do not raise a warning, unlike Python's unlimited integers, so wrong answers can pass silently.

Example. np.array([250], dtype=np.uint8) + 10 gives 4, not 260, because an 8-bit unsigned integer holds only 0 to 255.

Related: dtype, Type casting, Floating point, ndarray

Overplotting intermediate

A problem where so many points share the same space in a chart that they hide each other, making density impossible to judge. Remedies include making points partly transparent, shrinking them, sampling, binning into hexagons, or using a density plot.

Example. A scatter plot of 5 million taxi trips looks like a solid blob until alpha=0.05 is used to reveal dense areas.

Related: Scatter plot, Histogram, KDE plot, Small multiples

Pair plot intermediate

A grid of scatter plots showing every pair of numeric columns in a dataset, with each variable's distribution on the diagonal. It gives a fast overview of relationships and clusters during exploration, though it becomes unreadable with many variables.

Example. sns.pairplot(df[['area', 'rent', 'age']]) draws a 3 by 3 grid comparing area, rent and building age.

Related: Scatter plot, Seaborn, Exploratory data analysis, Small multiples

Pandas beginner

A Python library for working with tabular and time-labelled data. It provides the DataFrame and Series structures plus tools to load files, clean, reshape, join, group and summarise data. It is built on NumPy and is the everyday tool of data analysts and machine learning practitioners.

Example. pd.read_csv('sales.csv') loads a file into a table, and df.groupby('city')['revenue'].sum() gives revenue per city.

Related: DataFrame, Series, NumPy, pandas groupby

pandas concat intermediate

A pandas function that glues DataFrames or Series together, either stacking them vertically (adding rows) or placing them side by side (adding columns). Unlike a merge, it matches on the index rather than on chosen key columns and does not look for matching values.

Example. pd.concat([jan_df, feb_df, mar_df]) builds one table from three monthly files with the same columns.

Related: pandas merge, Concatenate, DataFrame, Index

pandas groupby beginner

A pandas operation that splits a table into groups sharing the same value in one or more columns, applies a calculation to each group, and combines the results. It answers questions like total sales per region and is the pandas counterpart of SQL GROUP BY.

Example. df.groupby('city')['revenue'].mean() gives the average revenue for each city.

Related: Split-apply-combine, Aggregation, Pivot table, GROUP BY

pandas Index beginner

The set of labels attached to the rows (or columns) of a Series or DataFrame. It lets you look up data by label rather than position, and pandas uses it to line up data automatically when combining objects. It can hold numbers, text or dates.

Example. A DataFrame of orders indexed by order_id lets you fetch one order with df.loc[10452].

Related: DataFrame, MultiIndex, set_index, loc

pandas merge intermediate

A pandas function that combines two DataFrames by matching values in key columns, like a database join. The how option chooses inner, left, right or outer behaviour, and mismatched or repeated keys can change the number of rows, so row counts should be checked afterwards.

Example. orders.merge(customers, on='customer_id', how='left') adds customer details to each order, keeping orders with no match.

Related: concat, JOIN, Index, DataFrame

Pie chart beginner

A circle divided into slices whose angles are proportional to each category's share of a total. It works only for a few parts of a whole; with many slices or similar values, people compare lengths in a bar chart far more accurately.

Example. A pie of a household budget with rent 40, food 30, transport 20 and other 10 percent is readable; the same with 15 slices is not.

Related: Bar chart, Stacked bar chart, Data-ink ratio, Area chart

Pivot table intermediate

A summary table in which the distinct values of one column become the rows, another column's values become the headers, and a chosen statistic fills the cells. In pandas it is made with pivot_table and works like a spreadsheet pivot.

Example. df.pivot_table(index='city', columns='month', values='sales', aggfunc='sum') shows total sales for every city in each month.

Related: pandas groupby, melt, crosstab, unstack

Plotly intermediate

A charting library that produces interactive graphics, with hover tooltips, zooming and panning, that run in a browser or notebook. It covers common statistical charts, maps and 3-D plots, and its figures are often used in dashboards.

Example. px.scatter(df, x='area', y='rent', hover_name='locality') makes a scatter plot where hovering shows the locality.

Related: Matplotlib, Seaborn, Scatter plot, Dashboard

pyplot beginner

The Matplotlib module, usually imported as plt, that is a collection of state-based functions for quickly creating figures and plots, usually imported as plt. It keeps track of the current figure and axes, so simple commands like plt.plot and plt.title act on them.

Example. import matplotlib.pyplot as plt; plt.hist(marks); plt.title('Marks') draws and titles a histogram.

Related: Matplotlib, Figure, Axes, subplots

query intermediate

A pandas method that filters rows using a condition written as a string, such as 'age > 30 and city == "Pune"'. It can be shorter and easier to read than Boolean indexing, especially inside method chains.

Example. df.query('sales > 1000 and city == "Pune"') keeps Pune rows with sales above 1000.

Related: Boolean indexing, Method chaining, loc, DataFrame

Random number generator intermediate

The NumPy object, created with np.random.default_rng, that produces pseudo-random numbers from many distributions. It uses a deterministic algorithm, so the same starting state gives the same sequence. It is the recommended modern replacement for the older global np.random functions.

Example. rng = np.random.default_rng(42); rng.normal(0, 1, size=3) draws three values from a standard normal distribution.

Related: Random seed, Sampling, NumPy, ndarray

Ravel intermediate

Flattening a multi-dimensional array into one dimension by reading its elements in order. It returns a view when possible and a copy only when it must, whereas the similar flatten method always copies. It is used when a model or function expects a flat list of values.

Example. np.array([[1, 2], [3, 4]]).ravel() returns array([1, 2, 3, 4]).

Related: Reshape, Array view, Array copy, C order

read_csv beginner

A pandas function that loads a comma-separated text file into a DataFrame. Options control the separator, column types, date parsing, missing-value markers and which columns or rows to read. It is usually the first line of any analysis.

Example. pd.read_csv('customers.csv', parse_dates=['signup_date']) loads the file and reads the signup column as dates.

Related: DataFrame, Chunked reading, to_datetime, .npy file

Reduction intermediate

An operation that collapses many values along an axis into fewer values, such as sum, mean, min, max or standard deviation. Giving an axis controls which dimension is collapsed, and keepdims=True keeps the collapsed axis as length 1 so results still broadcast.

Example. a.sum(axis=0) on a (100, 3) array returns 3 column totals; a.sum() returns one grand total.

Related: Axis, Aggregation, Broadcasting, Cumulative sum

resample intermediate

A pandas method that changes the frequency of time-indexed data, for example grouping daily rows into monthly ones and combining each period with an aggregation. It requires a datetime index and works like a groupby over time periods.

Example. daily_sales.resample('M').sum() converts daily sales into monthly totals.

Related: DatetimeIndex, pandas groupby, Rolling window, Time series

reset_index beginner

A pandas method that turns the current index into an ordinary column and replaces it with a plain 0, 1, 2 counter. It is commonly needed after groupby or filtering, when the labels are no longer useful as an index.

Example. df.groupby('city')['sales'].sum().reset_index() returns a normal table with city and sales columns.

Related: set_index, Index, pandas groupby, DataFrame

Reshape beginner

Changing the shape of an array without changing its data, for example turning a flat list of 12 values into a 3 by 4 grid. The total number of elements must stay the same, and one dimension may be given as -1 to let NumPy work it out.

Example. np.arange(12).reshape(3, 4) makes a 3 by 4 array; reshape(-1, 2) would make 6 rows of 2.

Related: Shape, Ravel, Array view, Array transpose

Rolling window intermediate

A pandas tool that applies a calculation, such as a mean, over a sliding block of the most recent rows. It smooths noisy data and shows trends; the first rows are NaN until the window is full unless min_periods is set.

Example. df['sales'].rolling(7).mean() gives a 7-day moving average of daily sales.

Related: resample, Moving average, shift, Cumulative sum

savefig beginner

The Matplotlib call that writes a figure to an image or document file such as PNG, SVG or PDF. The dpi setting controls resolution in pixels per inch, and bbox_inches='tight' trims empty margins. It is used to export charts for reports and slides.

Example. fig.savefig('sales.png', dpi=200, bbox_inches='tight') writes a sharp PNG of the chart.

Related: Figure, Matplotlib, pyplot, Axes

Scatter plot beginner

A chart that draws each observation as a dot positioned by two numeric values, one on each axis. It reveals relationships, clusters and outliers between two variables, and colour or size can encode a third and fourth variable.

Example. Plotting each flat's area against its rent for 500 flats in Bengaluru shows that rent rises with area, with a few expensive outliers.

Related: Overplotting, Line plot, Pair plot, Correlation

Seaborn beginner

A Python statistical plotting library built on Matplotlib. It draws attractive plots such as box plots, violin plots, heatmaps and pair plots directly from DataFrames with a few lines, and handles grouping by colour and summarising automatically.

Example. sns.boxplot(data=df, x='city', y='rent') draws a box plot of rent for each city.

Related: Matplotlib, Pair plot, Heatmap, DataFrame

Series beginner

Pandas' one-dimensional labelled array: a column of values of one data type together with an index of labels. It supports vectorised arithmetic, alignment on labels and many summary methods. Each column of a DataFrame is one of these.

Example. pd.Series([90, 75, 82], index=['maths', 'physics', 'chemistry']) stores three marks that can be read as s['physics'].

Related: DataFrame, Index, ndarray, Vectorization

SettingWithCopyWarning intermediate

A pandas warning raised when you assign into something that may be a temporary copy of a slice rather than the original table, so the change may be lost. It is avoided by using loc for assignment or by making an explicit copy.

Example. df[df['age'] > 30]['flag'] = 1 may not change df; df.loc[df['age'] > 30, 'flag'] = 1 does.

Related: loc, Array view, Copy-on-write, Method chaining

Shape beginner

A tuple giving the length of an array along each of its dimensions. The product of its entries equals the total number of elements. Nearly every array bug in data and machine learning code is a mismatch of these lengths, so checking it is the first debugging step.

Example. A batch of 32 greyscale images of 28 by 28 pixels stored as an array has shape (32, 28, 28).

Related: ndarray, Reshape, Axis, Broadcasting

shift intermediate

A pandas method that moves values up or down by a number of rows while keeping the index fixed, leaving NaN at the empty end. It is used to compare a row with a previous one or to create lag features for forecasting.

Example. df['prev_day'] = df['price'].shift(1) puts yesterday's price next to today's price in each row.

Related: Rolling window, Lag feature, Time series, DatetimeIndex

Small multiples advanced

A grid of many small charts that share the same axes and design, each showing a different subset of the data. The viewer compares patterns by eye across panels, avoiding one crowded chart. Seaborn's FacetGrid and Matplotlib's subplots make them.

Example. One small line chart of monthly sales for each of 12 states, all with the same y-axis range.

Related: subplots, Pair plot, Overplotting, Seaborn

sort_values beginner

A pandas method that reorders the rows of a DataFrame by the values in one or more columns, ascending or descending. It returns a new table rather than changing the original unless told to, and is used for rankings and top-N lists.

Example. df.sort_values('revenue', ascending=False).head(5) gives the five highest-revenue rows.

Related: argsort, DataFrame, reset_index, pandas groupby

Split-apply-combine intermediate

The three-step pattern behind grouped analysis: split the data into groups, apply a function to each group independently, then combine the outputs into one result. Understanding it explains what groupby, agg, transform and apply each return.

Example. Splitting exam results by school, computing each school's average, and assembling those averages into one table.

Related: pandas groupby, agg, transform, apply

Stacked bar chart intermediate

A bar chart in which each bar is split into segments stacked end to end, one per sub-category, so it shows a total and its composition together. Only the bottom segment and the total are easy to compare, so more than a few segments become hard to read.

Example. Each bar shows a month's orders, split into app, web and phone orders stacked on top of each other.

Related: Bar chart, Area chart, Pie chart, Small multiples

str accessor intermediate

The .str namespace on a pandas text column that applies string operations such as lower, strip, contains, replace and split to every value at once, skipping missing entries. It is the standard way to clean text columns without loops.

Example. df['name'].str.strip().str.title() removes extra spaces and capitalises every name.

Related: dt accessor, Regular expression, apply, Data cleaning

Strides advanced

The number of bytes NumPy must skip in memory to move one step along each axis of an array. They explain how views, slices and transposes can reinterpret the same data without copying it, and why the order in which you loop over an array affects speed.

Example. For a C-ordered float64 array of shape (3, 4), strides are (32, 8): 8 bytes to the next column and 32 to the next row.

Related: C order, Array view, Array transpose, ndarray

subplots beginner

The Matplotlib function that creates a figure together with a grid of axes in one call, returning both. It is the standard way to place several charts side by side, sharing axes if wanted.

Example. fig, axes = plt.subplots(1, 2, figsize=(10, 4)) gives one row with two charts.

Related: Figure, Axes, Small multiples, pyplot

Tidy data intermediate

A way of organising a table where each variable forms a column, each observation forms a row, and each type of observational unit forms its own table. Data in this form works smoothly with grouping, plotting and modelling tools.

Example. A table with columns city, month and sales, one row per city-month, is tidy; a table with one column per month is not.

Related: melt, Pivot table, DataFrame, Data cleaning

to_datetime intermediate

A pandas function that converts text or numbers into proper datetime values. Once a column is a datetime, you can sort by time, compute differences and resample. A format string avoids ambiguity such as day-first versus month-first dates.

Example. pd.to_datetime('05/03/2026', format='%d/%m/%Y') reads the date as 5 March 2026, not 3 May.

Related: DatetimeIndex, dt accessor, resample, astype

transform advanced

A pandas method that returns a result with the same length as the original data, after computing a per-group or per-column calculation. It is used to add group-level values back onto each row, such as a row's share of its group total.

Example. df['share'] = df['sales'] / df.groupby('city')['sales'].transform('sum') gives each sale as a fraction of its city's total.

Related: pandas groupby, agg, apply, Split-apply-combine

Type casting intermediate

Converting an array's values from one data type to another, for example floats to integers, using astype. Down-casting may drop decimals or lose precision, and mixing types in an operation makes NumPy pick a common type, which can silently change results.

Example. np.array([1.9, 2.7]).astype(int) returns array([1, 2]), because the decimals are cut off, not rounded.

Related: dtype, NumPy integer overflow, astype, ndarray

Universal function intermediate

A NumPy function that applies the same operation to every element of an array (or pairs of elements from two arrays) and returns an array of the results. Examples are add, sqrt, exp and maximum. They are implemented in compiled code, support broadcasting, and can also offer extras such as reduce and accumulate.

Example. np.sqrt(np.array([1, 4, 9])) returns array([1., 2., 3.]) without any Python loop.

Related: Vectorization, Broadcasting, Element-wise operation, NumPy

unstack advanced

A pandas method that moves an inner level of a row index into the column headers, turning a long, stacked layout into a wider table. Its inverse, stack, moves column labels into the row index. Both work on a MultiIndex.

Example. A series indexed by (city, month) becomes a table with cities as rows and months as columns after s.unstack().

Related: MultiIndex, Pivot table, melt, pandas groupby

value_counts beginner

A Series method that counts how many times each distinct value appears and returns the counts sorted from most to least frequent. With normalize=True it returns proportions. It is often the first check of a categorical column.

Example. df['city'].value_counts() might show Bengaluru 420, Pune 310, Chennai 270.

Related: pandas groupby, crosstab, describe, Series

Vectorization beginner

Writing computations as operations on whole arrays instead of Python loops over single elements. The looping then happens inside optimised compiled code, which is usually tens to hundreds of times faster and also shorter to read. Vectorised style is the normal way to write numerical code in NumPy and pandas.

Example. prices * 1.18 adds 18 percent GST to every price in an array at once, replacing a for loop over each item.

Related: NumPy, Universal function, Broadcasting, apply

Violin plot intermediate

A chart that combines a box plot with a mirrored density curve, showing the full shape of a distribution for each group. Where the shape is wide, many values lie there. It reveals features such as two peaks that a box plot hides.

Example. Violin plots of exam scores for three coaching centres can show one centre's scores split into two clusters.

Related: Box plot, KDE plot, Histogram, Seaborn