Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

Getting Started With Pandas: A Practical Cheatsheet

Get started with pandas using concise examples for DataFrames, CSV files, selection, missing values, summaries, grouping, merging, reshaping, and official learning resources.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use this quick reference to install pandas, create or load a table, inspect and select data, handle missing values, summarize columns, and move on to grouping, merging, and reshaping. The examples follow the pandas 3.0.6 documentation dated September 17, 2026; pandas is an open-source Python library for working with data structures and analysis. Official pandas documentation.

What is pandas, and what kind of data does it handle?

pandas is a Python library for exploring, cleaning, and processing tabular data, such as information kept in spreadsheets or databases. Its two core structures are Series and DataFrame.

  • Series: a one-dimensional labeled array, like one column of values with an index.
  • DataFrame: a two-dimensional labeled table. Its columns can hold different data types.

Labels are important: pandas aligns data by index and column labels during many operations. Two values that look like they are in the same position may not be combined if their labels differ. Learn the basics in the official introduction to pandas data structures.

How do I install and import pandas?

The pandas installation guide recommends installing and running pandas in a virtual environment. Choose the command that matches your package manager; the official docs also describe source installation for users who specifically need it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Conda: conda install -c conda-forge pandas
  • pip: pip install pandas

Installation methods are alternatives, not a performance ranking. Check the pandas installation guide for current details.

In a Python script or notebook, use the conventional alias:

import pandas as pd

How do I create or read a table?

Create a small DataFrame

A dictionary is a convenient way to build a table: dictionary keys become column names, and corresponding lists supply the values.

import pandas as pd

data = {
    "name": ["Ava", "Noah", "Mia"],
    "score": [88, 92, 85],
}
df = pd.DataFrame(data)

Read a CSV file

Use read_csv to load CSV data into a DataFrame. Replace the filename with your file’s path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
df = pd.read_csv("scores.csv")

The reader functions generally follow a read_* naming pattern. pandas documentation lists CSV, Excel, SQL, JSON, and Parquet among supported data sources and formats. See the official read-and-write tutorial for format-specific examples.

How do I inspect a DataFrame?

Start by checking a few rows, the dimensions, column types, and a statistical summary. These quick checks help reveal whether the data loaded as expected.

df.head()       # first rows
df.shape        # (number of rows, number of columns)
df.columns      # column labels
df.dtypes       # data type of each column
df.info()       # concise structural summary
df.describe()   # summary statistics for numeric columns

For example, df.shape returns a pair of counts, while df.describe() summarizes numeric columns. Consult the pandas basics guide for additional inspection and summary methods.

How do I select rows and columns?

Choose selection methods according to whether you know labels or integer positions. loc works with labels; iloc works with positions. Use at and iat for optimized access to a single labeled or position-based value, respectively. The 10 Minutes to pandas guide also introduces bracket selection, while recommending these access methods for production code.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
df["score"]                         # one column as a Series
df[["name", "score"]]              # selected columns as a DataFrame
df.loc[0, "name"]                   # value at row label 0, column "name"
df.iloc[0, 1]                        # value at row position 0, column position 1
df.loc[df["score"] >= 90, ["name", "score"]]  # rows meeting a condition

In loc, the row key is an index label, which need not be the row’s current numeric position. For more detail, use the indexing and selecting data guide.

How do I handle missing data?

Check for missing values before deciding how to handle them. isna() marks missing entries, and sum() counts them by column. Depending on the task, you can drop rows with missing values or fill them with a chosen value.

df.isna().sum()            # missing-value count per column
df.dropna()                # return rows with no missing values
df.fillna(0)               # return a copy with missing values replaced by 0

Dropping or filling values changes what the data means, so choose a rule that fits the analysis rather than applying one automatically. The missing data guide covers the available options.

How do I transform columns and calculate summary statistics?

Many everyday changes can be expressed as operations on a column. Assigning the result back to a column stores the transformed values in the DataFrame.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
df["score_plus_one"] = df["score"] + 1
df["name_upper"] = df["name"].str.upper()
df["score"].mean()       # mean of the score column
df["score"].min()        # smallest score
df["score"].max()        # largest score

For more summary statistics, try df["score"].median() or df["score"].value_counts(), depending on whether you need a numeric summary or a count of distinct values. pandas also supports elementwise column manipulation and descriptive statistics; see the basics guide.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When should I group, merge, or reshape data?

Group rows to summarize categories

Use groupby when you want a summary for each category, such as the average score for each class.

df.groupby("class")["score"].mean()

Merge related tables

Use merge to combine DataFrames using a shared key, much like a database join.

result = pd.merge(students, grades, on="student_id")

Reshape a table

Reshaping changes how values are arranged across rows and columns. For example, pivot can turn category values into columns when the chosen index-and-column combination identifies a single value.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
wide = df.pivot(index="date", columns="category", values="amount")

See the official guide sections on grouping, merging, and reshaping for options and details.

How do I write a table to a file?

Use the corresponding writer method for the format you need. For a CSV, call to_csv; index=False prevents the DataFrame index from being written as an extra column when it is not needed.

df.to_csv("cleaned_scores.csv", index=False)

The read-and-write tutorial demonstrates supported formats and their matching methods. Confirm the options for your target format in the official tutorial.

What should I learn next?

If you are new to pandas, the project recommends starting with 10 Minutes to pandas. It introduces the basic structures and object creation, then covers viewing and selection, missing data, operations, merging, grouping, reshaping, time series, categoricals, plotting, and input/output. It is an overview, not a complete reference; follow the relevant links into the User Guide when you need the details for a specific task.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a longer-form learning resource, the pandas project also recommends Wes McKinney’s book Python for Data Analysis. It is optional; the official documentation provides a free path to continue learning.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.