How to Use Pandas in Python for Data Analysis: Beginner’s Guide

A student receives a spreadsheet containing fictional subject choices, study hours, attendance percentages and exam scores. What is the average score? Which subject has the highest average? Is any entry missing, duplicated or unusually high? Rather than calculate each answer by hand, a few Pandas commands can investigate the table consistently.

A student studies a data table in a Python notebook on her laptop in a school computer lab.

This Pandas Python tutorial for beginners is a hands-on guide to tabular analysis. You will create a DataFrame, read a CSV, inspect its rows, filter and sort records, clean missing values, calculate statistics, group by subject, combine tables and prepare useful charts. Every key operation includes a short explanation and a result you can verify.

Our continuing classroom example uses invented student identifiers and invented scores, never actual personal records. The raw file contains ten rows with a repeated record and two incomplete cells. By the end, eight complete score observations remain and you will be able to explain exactly why.

Learning outcomes: import Pandas; work with Series, DataFrames and indices; read CSV and optional Excel files; apply loc, iloc and Boolean filters; handle missing data and duplicates; calculate groupby summaries; merge datasets; and explain a small reproducible project.

What is Pandas in Python?

Pandas is an open-source Python library for labeled, structured data. It helps read spreadsheet-like files, select rows, clean records, calculate summary statistics and prepare visualizations. In education, a teacher might summarize anonymous results; in health research, analysts may study approved aggregate measurements. Similar tools support finance, environmental monitoring and business reports.

Think of a Python list as a sequence of values, a Pandas Series as a labeled one-dimensional collection, and a DataFrame as a table with multiple named columns. A DataFrame has an index indicating row labels, but its index is not automatically a unique student identifier. Choose explicit IDs when records need to be matched.

Pandas excels at reasonably sized tabular data, but it cannot independently determine whether a source is trustworthy, whether an observation is biased or whether a finding is causal. Specialized databases, distributed systems and image-processing tools may suit very large or non-tabular information better. Start with a clear question rather than choosing a library for its reputation.

Why learn Pandas for data analysis?

One workflow can import CSV or Excel information, validate columns, filter records, identify missing entries, calculate averages, assemble groups and export an auditable summary. Unlike repeatedly clicking cells, code makes the sequence of operations readable and repeatable when the dataset changes. It also helps you notice how decisions about missing values alter your answers.

Pandas connects naturally with NumPy for numerical arrays, Matplotlib for graphs and later machine-learning tools. Yet learning to clean and describe data responsibly is valuable on its own. For a general Python foundation before this lesson, follow Topic 44: Python for Data Science Beginners.

Install and import Pandas

Option 1: Google Colab

Open Google Colab using an eligible account, select New notebook and run a cell with import pandas as pd. Common data-analysis packages are usually provided, although hosted versions and available computing resources vary. Use school-approved accounts and do not upload identifiable student records.

Option 2: Local Python or Jupyter

Install Python from Python.org. In a terminal, use python -m pip install pandas matplotlib, or python3 -m pip on systems that use that command. A managed school computer may restrict installation; follow its policies. Jupyter notebooks are optional and require a suitable installation if not using Colab.

import pandas as pd
print(pd.__version__)

Expected result: Python prints whichever Pandas version is installed, not one universal version number. These examples use established methods supported in Pandas 2.2 and described in the current 3.x documentation. Pandas 3.0 introduced new default string handling and Copy-on-Write behavior, so code that relies on ambiguous views or chained assignment should be updated.

Series and DataFrames: Understand the main objects

We will now construct the entire example dataset in one place. Each row includes a fictional Student ID, subject, weekly study hours, attendance percentage and score out of 100. One row repeats S08, S06 has no recorded attendance and S09 has no score. These are deliberate teaching defects, not observations of real children.

import pandas as pd
records = [
 ["S01","Math",2,90,55],
 ["S02","Science",3,92,62],
 ["S03","Math",4,96,70],
 ["S04","Science",5,88,81],
 ["S05","English",6,94,92],
 ["S06","English",3,None,68],
 ["S07","Math",5,98,84],
 ["S08","Science",4,93,76],
 ["S08","Science",4,93,76],
 ["S09","English",2,85,None]
]
columns = ["Student","Subject","StudyHours",
           "AttendancePct","Score"]
df = pd.DataFrame(records, columns=columns)
print(df.shape)
print(df.head(3))

Expected output: (10, 5), meaning ten rows and five columns. The first three records are S01 Math 2 hours/score 55, S02 Science 3 hours/score 62 and S03 Math 4 hours/score 70. None becomes a missing value when Pandas constructs the numeric columns.

A DataFrame’s default index starts at zero and follows row positions until you deliberately change it. Column names such as StudyHours are labels, so capitalization and spelling matter. A Series can be obtained with df['Score']; two columns form a DataFrame with df[['Student','Score']].

StudentSubjectHoursAttendance %Score
S01Math29055
S02Science39262
S03Math49670
S04Science58881
S05English69492
S06English3Missing68
S07Math59884
S08Science49376
S08Science49376
S09English285Missing
The complete raw fictional DataFrame. One record is duplicated and two cells are missing.

How do you inspect a Pandas DataFrame?

Before answering a statistical question, examine the structure. head() displays the beginning, tail() the end, shape the table dimensions and columns the labels. dtypes lists each column’s type. The info() method prints a summary of non-null counts and types, while describe() provides descriptive statistics for numeric columns.

print(df.head(2))
print(df.tail(2))
print(df.shape)
print(df.columns.tolist())
print(df.dtypes)
df.info()
print(df.describe())

Notice that shape and columns are attributes, not methods; they do not take parentheses. In contrast, head() and info() are called with parentheses. Avoid print(df.info()), since info() already prints its information and returns None.

The raw dataset has ten records, but this is not the true number of distinct usable score observations. Preliminary inspection reveals that data validation is necessary before reporting a class average. Record those issues in a notebook rather than silently hiding them during cleaning.

How to read CSV and Excel files with Pandas

A CSV is a plain-text table with commas separating fields. An Excel workbook can contain multiple worksheets and formatting. Both are common inputs, but a reproducible example must actually create or provide the file before asking readers to load it. The next code cell writes our existing DataFrame to the working directory.

df.to_csv("students.csv", index=False)
loaded = pd.read_csv("students.csv")
print("Loaded:", loaded.shape)
print("Columns:", loaded.columns.tolist())

Output: Loaded: (10, 5), followed by all five column names. The index=False option prevents exporting Pandas’ temporary row index as an extra unnamed CSV column. The code can be repeated in Colab or local Python without any external download.

For Excel files, pd.read_excel('students.xlsx') reads a workbook when that file exists and the necessary Excel engine is installed. A reproducible optional round trip is df.to_excel('students.xlsx', index=False) followed by pd.read_excel('students.xlsx'); an openpyxl installation may be required for .xlsx. If a FileNotFoundError appears, check filenames and the current working folder, not just the code syntax.

Selecting Pandas rows and columns: loc versus iloc

Use square brackets to select a named column and a list of names for multiple columns. loc selects by row and column labels, while iloc uses zero-based integer positions. They are not interchangeable, especially when your DataFrame has a non-default index.

print(df["Student"].head(3).tolist())
print(df[["Student","Score"]].head(2))
print(df.loc[0:2, ["Student","Subject"]])
print(df.iloc[0:2, 0:3])

Expected IDs: the first three are S01, S02 and S03. The label slice loc[0:2] includes labels 0, 1 and 2 in this default index, but positional iloc[0:2] includes only positions 0 and 1. Both use the same source table; selecting does not automatically edit it.

With the default integer index, df.loc[0:2] selects S01, S02 and S03. The positional slice df.iloc[0:2] selects S01 and S02.
Try predicting the last row before you run each slice. With this index, S03 appears only in the label-based result.

For a named student, filter by the Student column rather than assuming index 3 always means S04. In real datasets identifiers can repeat or change, and applying a filter may leave nonconsecutive row indices. Reset the index only when that serves your workflow.

Filtering rows in Pandas with conditions

A Boolean condition creates a True/False mask for every row. Use df.loc[mask, columns] to keep matching records. Combine conditions with & for AND or | for OR, with parentheses around each comparison. Do not substitute ordinary Python and/or between whole Pandas Series.

high_scores = df.loc[
    df["Score"] >= 75, ["Student","Subject","Score"]
]
print(high_scores["Student"].tolist())

both = df.loc[
    (df["Score"] >= 75) & (df["StudyHours"] >= 4),
    ["Student","StudyHours","Score"]
]
print(both["Student"].tolist())

Raw output: both lists contain S04, S05, S07, S08 and S08. That second S08 is not a new high performer; it is our deliberately duplicated source row. This is a useful warning: an apparently valid filter can still produce misleading totals if the input data have duplicates.

Try df.loc[df['Subject'].eq('Science')] for the Science rows. Later, rerun the filters on the cleaned DataFrame: there will be only four matching score-75 observations. Make sure your chosen threshold is explained rather than treating 75 as a universal educational cutoff.

Sorting data with sort_values()

sort_values() orders rows by one or more columns. It does not permanently modify the input unless you explicitly assign the result. The default direction is ascending, while ascending=False places the largest values first.

ranked = df.sort_values("Score", ascending=False)
print(ranked[["Student","Score"]].head(3))
ordered = df.sort_values(
    ["Subject","Score"], ascending=[True,False]
)
print(ordered[["Subject","Score"]].head(3))

The highest raw score belongs to S05 (92); next is S07 (84), then S04 (81). Grouped sorting begins with English because the subject labels sort alphabetically. Repeated records and missing values can still affect any ranking. For fair comparisons, work on validated data.

How to handle missing values in Pandas

Missingness can mean not recorded, not applicable or genuinely unknown. isna() identifies missing cells, dropna() can remove selected incomplete rows and fillna() substitutes an explicitly chosen value. A missing examination result is not automatically a score of zero, and a missing attendance figure should not be invented.

print(df.isna().sum())
print("Duplicate rows:", df.duplicated().sum())

Verified counts: AttendancePct has one missing value and Score has one; all other columns have zero missing values. One entire row is duplicated. Whether to drop or impute missing information depends on the investigation, source and likely bias.

A student uses a pencil to bracket two rows and circle an empty cell on a printed practice table.
In the practice CSV, S08 appears twice. S06 is missing attendance, while S09 is missing a score. Which of those gaps matters for an average score?

For this descriptive classroom exercise, we exclude S09 because the research question requires a recorded score. We keep S06 because the score is known, and fill its missing attendance with the median of observed attendance values after excluding S09. That median is 93%. This is an illustration, not a default rule for real student records.

Removing duplicates and correcting data types

Duplicate detection uses duplicated(); drop_duplicates() removes exact repeated rows. Two genuine events can share all visible fields, so an analyst should verify whether identical rows are actually accidental duplicates before deleting them. Here the repeated S08 entry was inserted deliberately and is safe to remove.

clean = df.drop_duplicates().copy()
for col in ["StudyHours","AttendancePct","Score"]:
    clean[col] = pd.to_numeric(clean[col], errors="coerce")

clean = clean.dropna(
    subset=["StudyHours","Score"]
).copy()
median_att = clean["AttendancePct"].median()
clean["AttendancePct"] = clean["AttendancePct"].fillna(
    median_att
)
clean = clean.reset_index(drop=True)
print("Attendance median:", median_att)
print("Clean shape:", clean.shape)
print("Clean mean:", clean["Score"].mean())

Verified output: Attendance median: 93.0, Clean shape: (8, 5) and Clean mean: 73.5. The eight clean records preserve all eight known scores; S06’s unknown attendance is now 93 by our declared teaching method. This changes only the attendance summary, not the score average.

pd.to_numeric(..., errors='coerce') turns invalid numeric text into missing values so you can inspect them. For validated integer values, astype(int) can convert when no nulls remain. Prefer explicit assignment such as clean.loc[mask, 'Score'] = value rather than chained assignment, which can fail under current Pandas Copy-on-Write behavior.

Do not hide cleaning choices: Always preserve a raw copy, explain what counted as a duplicate, document which rows were excluded, and report whether a median or another imputation method was used. Clean-looking tables can still be biased.

StageNumber of recordsDecision
Raw CSV10One duplicated row; two missing cells
After duplicate removal9Remove repeated S08
After excluding missing scores8Exclude S09 without recorded score
After attendance imputation8Replace missing S06 attendance with median 93%
Before and after: a transparent cleaning log for this fictional example.

Descriptive statistics in Pandas: mean, median and spread

Descriptive statistics summarize a set of observations. mean() gives the arithmetic average; median() gives the middle ordered value; min() and max() show extremes. count() counts non-missing values, and std() reports sample standard deviation by default.

scores = clean["Score"]
print("Count:", scores.count())
print("Sum:", scores.sum())
print("Mean:", scores.mean())
print("Median:", scores.median())
print("Min/Max:", scores.min(), scores.max())
print("Sample SD:", round(scores.std(), 2))

Verified values: count 8, sum 588, mean 73.5, median 73, minimum 55, maximum 92 and sample standard deviation approximately 12.14. The score range is 92 − 55 = 37 points.

The mean is a descriptive result for these eight invented cases, not an estimate of any real school or country. A high or low value might reflect many factors that were not measured. Compare mean with median, examine variability and remember how missing-value treatment and sample selection shape the summary.

Pandas groupby tutorial: Average score by subject

groupby() splits records into categories and then applies a function to each group. For example, we can ask: What is the average recorded score in each fictional subject? Using the cleaned dataset avoids counting S08 twice and excludes the missing-score row.

means = clean.groupby("Subject")["Score"].mean()
print(means.round(2))
summary = clean.groupby("Subject")["Score"].agg(
    ["count","mean","min","max"]
)
print(summary.round(2))
SubjectRecordsMean scoreMinimumMaximum
English280.006892
Math369.675584
Science373.006281
Verified Pandas groupby results from the eight cleaned fictional records.
English averages 80.00 across two fictional scores, Math averages 69.67 across three, and Science averages 73.00 across three. The scale runs from 0 to 100.
English has the highest mean in this example, but it also has the smallest group. Its bar summarizes just two scores.

The mean is highest for English in this small constructed example, but that does not make English an intrinsically easier subject or establish group differences in actual populations. Groups have different sample sizes (two versus three), and all values were invented. agg() applies several summaries in one readable table.

For multiple grouping keys, such as subject and study-hour category, you can group by a list of column names. However, adding many subdivisions to eight rows would create tiny groups; more detail is not necessarily better evidence.

Combining datasets: concat() and merge()

pd.concat() stacks compatible tables, while merge() matches related tables through a shared key. Choose the correct method based on your data structure. Blindly merging without checking unique IDs can multiply rows and produce false counts.

first = clean.iloc[:4]
second = clean.iloc[4:]
combined = pd.concat(
    [first, second], ignore_index=True
)
print("Recombined:", combined.shape)

subject_info = pd.DataFrame({
    "Subject": ["English","Math","Science"],
    "Area": ["Language","Mathematics","Natural sciences"]
})
joined = clean.merge(
    subject_info, on="Subject",
    how="left", validate="many_to_one"
)
print("Joined:", joined.shape)

Expected shapes: Recombined: (8, 5) and Joined: (8, 6). The sixth column describes a subject area. validate='many_to_one' checks that each subject key is unique in the lookup table, helping prevent unexpected multiplication of rows.

How to create charts from a Pandas DataFrame

Pandas plotting uses Matplotlib as a common backend. A bar chart compares subject categories, a line plot is helpful for ordered time measurements, a histogram summarizes one numeric distribution, and a scatter plot shows pairs of numerical values. Choose an appropriate chart and make the axes clear.

ChartRecommended taskImportant caveat
BarCompare mean score by subjectState group size and baseline
LineFollow temperatures over datesKeep actual time order
HistogramShow the distribution of scoresSmall samples have unstable shapes
ScatterHours versus scoresAssociation is not proof of cause
Chart choices should reflect data types, units and the actual question.

The next code makes a bar chart from the verified subject means. It also shows how a scatter plot could investigate the relation between study hours and score. The plotting commands run after the earlier cleaning cell.

import matplotlib.pyplot as plt
means = clean.groupby("Subject")["Score"].mean()
ax = means.plot(kind="bar", color="#168357")
ax.set_title("Fictional mean score by subject")
ax.set_xlabel("Subject")
ax.set_ylabel("Mean score / 100")
ax.set_ylim(0, 100)
plt.tight_layout()
plt.show()

ax = clean.plot.scatter(
    x="StudyHours", y="Score",
    title="Fictional study hours and scores"
)
ax.set_xlabel("Study hours per week")
ax.set_ylabel("Practice score / 100")
plt.tight_layout()
plt.show()

The bar chart in the subject averages section shows 80.00 for English, 69.67 for Math and 73.00 for Science. The scatter plot below pairs each of the eight scores with that student’s weekly study hours. Run the code above and compare your results with both figures.

Eight fictional scores plotted against weekly study hours. Scores at 2, 3, 4, 5 and 6 hours are 55, then 62 and 68, then 70 and 76, then 81 and 84, then 92.
At four study hours per week, two fictional students scored 70 and 76. The dots show how results can differ even when study time is the same.

The scatter may rise for the invented records, yet it cannot show that additional studying caused a particular result. Ability, home resources, school practices, attendance, selection and measurement error could affect real analyses. A visual story must never exceed the evidence.

Complete project: Student Performance Data Analysis with Pandas

Your project question is: How do recorded scores differ across subjects in a fictional class, after basic data-quality checks? Record the source as simulated and list the columns and units. Then create the raw CSV, inspect blanks and duplication, convert numeric columns, retain complete scored observations, impute one attendance value, summarize groups, filter a selected score threshold and plot the subject means.

The following is a standalone script: it constructs exactly the same ten raw records, saves them to CSV, reloads that CSV and reproduces the cleaned eight-row analysis. It can be run in a fresh notebook or local Python session without requiring earlier cells.

from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt

rows = [
 ["S01","Math",2,90,55],
 ["S02","Science",3,92,62],
 ["S03","Math",4,96,70],
 ["S04","Science",5,88,81],
 ["S05","English",6,94,92],
 ["S06","English",3,None,68],
 ["S07","Math",5,98,84],
 ["S08","Science",4,93,76],
 ["S08","Science",4,93,76],
 ["S09","English",2,85,None]
]
fields = ["Student","Subject","StudyHours",
          "AttendancePct","Score"]
pd.DataFrame(rows, columns=fields).to_csv(
    "student-performance-demo.csv", index=False
)
raw = pd.read_csv("student-performance-demo.csv")
print("Raw:", raw.shape)
print("Duplicates:", int(raw.duplicated().sum()))
print("Missing:", raw.isna().sum().to_dict())

clean = raw.drop_duplicates().copy()
for col in ["StudyHours","AttendancePct","Score"]:
    clean[col] = pd.to_numeric(clean[col], errors="coerce")
clean = clean.dropna(
    subset=["StudyHours","Score"]
).copy()
fill_value = clean["AttendancePct"].median()
clean["AttendancePct"] = clean["AttendancePct"].fillna(
    fill_value
)
clean = clean.reset_index(drop=True)
print("Clean:", clean.shape)
print("Mean:", clean["Score"].mean())
print("Selected:", clean.loc[
    clean["Score"] >= 75, "Student"
].tolist())
groups = clean.groupby("Subject")["Score"].mean()
print(groups.round(2))

ax = groups.plot.bar(color="#168357")
ax.set_ylim(0, 100)
ax.set_title("Fictional score averages by subject")
ax.set_xlabel("Subject")
ax.set_ylabel("Mean score / 100")
plt.tight_layout()
plt.show()

Verified data results: Raw (10, 5); one duplicate; one missing attendance and one missing score. Clean (8, 5); average score 73.5; selected score-75 students S04, S05, S07 and S08; and group means English 80.0, Math 69.67, Science 73.0. The plot should reflect these three exact values, not invented differences.

Explain why S08 was removed as a duplicate and why S09 was excluded from the scored analysis. Note that S06’s attendance was filled with a median for illustration. If using genuine records, you must seek appropriate permission, safeguard identifiers and assess whether missingness is systematic. A reproducible result is not automatically a representative one.

Two students lean over a printed bar chart as one points to a bar and the other checks the result.
Ask a partner to read your chart. Can they tell what each bar measures and how many records contributed to it?

For your written conclusion, say what happened in the fictional dataset, how many rows contributed, what was excluded and what cannot be generalized. A teacher or teammate should be able to run the script and obtain the same values. This transparency is part of the scientific method rather than an optional technical detail.

Existing Notes for SHS editorial illustration about data analysis; not official IBM · Coursera artwork

IBM · Coursera · Optional online course

Data Analysis with Python

Optional further study covering NumPy, Pandas, data importing, cleaning and analysis. Course availability and enrollment conditions may vary.

Untracked official provider link, not a verified affiliate-tracking URL. Optional paid study; pricing and access vary.

Existing Notes for SHS editorial illustration about data analysis; not official Udemy artwork

Udemy · Optional online course

Data Analysis with Pandas and Python

Optional focused practice in Pandas DataFrames and practical analysis techniques, following the foundational lesson.

Untracked official provider link, not a verified affiliate-tracking URL. Optional paid study; pricing and access vary.

Common Pandas mistakes and troubleshooting

  • KeyError: a column label is misspelled or has unexpected spaces; inspect df.columns before selecting.
  • Confusing loc and iloc: labels and integer positions differ, particularly after filtering or reindexing.
  • Forgetting parentheses: df.head() calls a method; df.shape reads an attribute.
  • Ignoring missing scores: use isna() and state whether you exclude or impute, rather than blindly filling with zero.
  • Chained assignment: avoid forms such as df['Score'][mask] = 0; use df.loc[mask, 'Score'] = 0 deliberately.
  • Misreading types: imported numbers may be strings; validate with to_numeric before computing.
  • Assuming duplicates are always errors: investigate whether repeated rows represent genuine repeated events.
  • Overclaiming averages: compare group sizes and report bias, units, sampling and measurement limitations.

Pandas 3.x makes Copy-on-Write part of its default behavior, reinforcing the value of explicit transformation and assignment. If a command appears to have no effect, check whether you stored the returned DataFrame. A reliable workflow inspects intermediate results rather than running many unexplained changes at once.

Ten student practice exercises and answers

Complete the activities using the same fictional dataset. Try the task independently, then expand the answer. The exercises move from creating a small table to explaining a group summary.

1. Create a DataFrame

Try: Make a DataFrame with Hours [2,4] and Score [55,70].

Show the answer

pd.DataFrame({'Hours':[2,4],'Score':[55,70]}) produces two rows.

2. Select one column

Try: Choose the score column from the cleaned table.

Show the answer

clean['Score'] selects a Series with eight scores.

3. Inspect first rows

Try: Display the first three cleaned observations.

Show the answer

clean.head(3) returns S01, S02 and S03.

4. Filter a threshold

Try: Find IDs with scores at least 75 after cleaning.

Show the answer

clean.loc[clean['Score'] >= 75, 'Student'] gives S04, S05, S07 and S08.

5. Sort by score

Try: Show the three highest cleaned scores.

Show the answer

clean.sort_values('Score', ascending=False).head(3) shows S05 (92), S07 (84), S04 (81).

6. Count missing cells

Try: How many score cells were missing in the raw table?

Show the answer

df['Score'].isna().sum() returns 1.

7. Calculate a mean

Try: What is the mean cleaned score?

Show the answer

clean['Score'].mean() is 73.5.

8. Group by subject

Try: Which subject has the highest fictional mean?

Show the answer

clean.groupby('Subject')['Score'].mean() yields English 80, highest among the three.

9. Create a chart

Try: Which chart compares the three subject means?

Show the answer

A bar chart: clean.groupby('Subject')['Score'].mean().plot.bar() followed by plt.show().

10. Interpret the evidence

Try: Can our subject means prove one subject is harder?

Show the answer

No. The records are fictional, groups contain two or three scores and no comparable random sampling occurred.

Four-week Pandas learning roadmap

WeekWhat to learnPortfolio evidence
1Series, DataFrames, column types and inspectionAnnotated table of records
2loc/iloc, Boolean filters and sortingCorrect filtered and sorted outputs
3Missing values, duplicates, summaries and groupbyShort cleaning log and mean table
4Pandas plotting, merging and independent projectReproducible notebook with limitations
Suggested practice sequence; learners may need more time or repeated exercises.

Each week, type and modify the examples rather than merely reading them. Compare Python outputs with hand calculations for at least a few rows. If internet access is limited, plan calculations on paper and check them during a shared computer session. The purpose is durable understanding, not finishing every lesson quickly.

Frequently asked questions about Pandas

Is Pandas difficult for beginners?

It is approachable after basic Python syntax, but selecting data, missing-value decisions and indices require practice.

What is Pandas used for in data science?

It is primarily used to load, organize, filter, clean, combine, summarize and prepare tabular data for analysis.

Do I need to learn Python before Pandas?

Learn the basics of variables, lists, functions and importing libraries first; then practice DataFrames.

What is the difference between Pandas and NumPy?

NumPy focuses on numerical arrays; Pandas adds labeled Series and DataFrames, missing-data handling and tabular methods.

How do I create a DataFrame?

Pass a dictionary of equally sized lists or a list of records to pd.DataFrame().

Can Pandas read Excel files?

Yes. pd.read_excel() loads Excel workbooks when supported file engines such as openpyxl are available.

How should I remove missing values?

Inspect missingness, its likely cause and the research question. Use dropna or justified fillna rules; never assume blanks equal zero.

How do I filter DataFrame rows?

Use a Boolean mask, such as df.loc[df['Score'] >= 70]; combine separate conditions with parentheses and & or |.

Is Pandas free?

Yes, Pandas is open source. Online computing services, internet access and courses may have separate costs.

What should I learn after Pandas?

Practise visualizations, basic statistics, SQL, reproducible notebooks and appropriately sized independent projects.

Conclusion: Learn to question your data, not just run commands

You have used Pandas to build a DataFrame, inspect it, export and read a CSV, select columns, filter and sort records, investigate missingness, remove an explicit duplicate, compute statistics, compare subject groups, join a lookup table and prepare charts. The same fictional dataset supported the complete process, making the reported numbers independently checkable.

The important lesson is not a long list of commands. It is the ability to explain where data came from, what each field means, what changed during cleaning, and what evidence supports your conclusion. An attractive chart can still mislead if a repeated row, unsuitable imputation or unrepresentative sample remains hidden.

Build your next project with a small, legally reusable public dataset or another clearly fictional table. Preserve an original copy, document cleaning steps and report limitations. Then explore the preceding Python tutorial or the wider Notes for SHS project collection when you are ready.

References: Pandas Getting Started, Pandas User Guide, Copy-on-Write documentation, Python Documentation, Matplotlib Documentation and Google Colab FAQ. Reviewed November 2026. The optional courses use official provider pages, not validated affiliate links.