📢
Admissions Open | Free Career Counselling | Limited Scholarships
Register Now →

Learning Guides

Python Programming for Data Science: What to Learn First (with 4 Mini Projects)

Python programming for data science in the right order: the 20 pandas functions behind 63% of notebook code, a 6-week plan and 4 tested projects.

Laptop showing a data table, with steps leading toward a chart

Most beginners quit Python for data science in week three.

Not because Python is hard. Because they spend a month on classes, decorators and recursion that a data job rarely asks for, then open a real CSV file and freeze.

This guide fixes the order. Python programming for data science is a much smaller skill than "learning Python", and we have the data to prove it.

You'll get: - What 227 real data science notebooks actually use (and what they skip) - The 4-Layer Python Ladder: what to learn first, second and last - 4 mini projects, tested on pandas 3.0, including a real Indian dataset - A 6-week plan you can follow alongside college or a job

Let's get started.

Python programming for data science is the part of Python you need to load, clean, analyse, visualise and model data. In practice that means core Python (variables, lists, dictionaries, loops, functions) plus four libraries: NumPy for numbers, pandas for tables, Matplotlib or Seaborn for charts, and scikit-learn for machine learning.

Quick answer: Python programming for data science (November 2026)

  • Learn core Python first: variables, lists, dictionaries, loops, if statements and functions; classes can wait.
  • In our count of 227 teaching notebooks, just 20 pandas functions covered 63% of all 2,735 pandas calls.
  • pandas 3.0 (January 2026) changed string handling and copy behaviour, so prefer tutorials updated for it.
  • Learn in four layers: core Python, then NumPy and pandas, then charts, then scikit-learn.
  • A beginner studying about 8 to 10 hours a week can finish the four layers and four mini projects in about 6 weeks.

What Is Python Programming for Data Science?

Python programming for data science is a focused subset of Python built around working with data, not building apps or games. A web developer needs frameworks, servers and classes. A data analyst or data scientist needs to read a file, fix messy values, summarise numbers and explain the result.

Here's how the two paths differ:

Topic General Python course Python for data science
Variables, lists, dictionaries, loops Yes Yes, learn first
Functions Yes Yes, learn first
Classes and inheritance Early Later, read-only at first
File handling Text files CSV and Excel through pandas
Main libraries Flask, Django, Tkinter NumPy, pandas, Matplotlib, Seaborn, scikit-learn
Where you write code Editor and terminal Jupyter Notebook or Google Colab
First "real" project Calculator or game Analyse a CSV and answer a question

If you're new to the field itself, start with our plain-English guide on what data science is, then come back here.

Python programming for data science path compared with a general Python course
Same language, much shorter route to your first data project.

Why Python Still Leads Data Science in 2026

Python is still the default language for data science in 2026, and the gap is growing. Python sits at No. 1 in the TIOBE Index with a 20.86% rating in November 2026 (TechRepublic).

Developers are moving toward it too. The 2025 Stack Overflow Developer Survey found Python used by 58% of developers, a 7-point jump in a single year (App Developer Magazine).

And it's a beginner's language. JetBrains' State of Python 2025 report found that 41% of Python developers use it for machine learning (JetBrains). Half of all respondents had less than two years of coding experience.

So you're not late.

Most Python users started recently.

Note: Python alone won't get you a data job, so pair it with SQL (start with our SQL joins guide), Excel and statistics, as mapped in our data science roadmap.

What 227 Notebooks Reveal About Python Programming for Data Science

The Fireblaze Notebook Count is our analysis of 227 unique data science teaching notebooks from six popular public GitHub repositories, done on 24 November 2026. We parsed every code cell with Python's own ast module and counted which language features and pandas functions actually appear.

The six sources were Jake VanderPlas's Python Data Science Handbook and Wes McKinney's Python for Data Analysis book code (Wes created pandas). We added Aurélien Géron's Hands-On Machine Learning, Microsoft's Data Science for Beginners, the pandas_exercises collection and data-science-ipython-notebooks.

Here's what stood out.

Finding 1: You need far fewer pandas functions than you think

Across 114 notebooks that import pandas, we found 2,735 pandas calls using 169 different functions. Just 11 functions made up half of all calls. The top 20 made up 63%.

Rank pandas function Share of calls Running total
1 DataFrame() 7.9% 7.9%
2 head() 7.2% 15.0%
3 Series() 6.9% 21.9%
4 groupby() 5.0% 26.9%
5 plot() 4.9% 31.8%
6 read_csv() 3.9% 35.7%
7 sum() 3.7% 39.4%
8 .loc 3.4% 42.8%
9 mean() 3.3% 46.1%
10 .iloc 2.5% 48.6%
11 .str 1.9% 50.5%
12 to 20 apply, .columns, resample, merge, fillna, value_counts, sort_values, dropna, date_range 12.6% 63.1%

That's your first pandas syllabus. Learn these 20 well before you touch anything else in the pandas docs.

Finding 2: Classes are rare; functions and loops are everywhere

Here's the share of the 227 notebooks that use each core Python feature at least once:

Python feature Notebooks using it
Functions (def) 46%
for loops 45%
Dictionaries 37%
List comprehensions 30%
if statements 26%
lambda 11%
Classes (class) 11%
try/except 7%
while loops 3%

Classes show up in about 1 in 9 notebooks, mostly in the advanced machine learning book. For a beginner, functions, loops and dictionaries matter four times more than object-oriented programming.

Finding 3: NumPy is the quiet foundation

NumPy was imported in 79% of notebooks, Matplotlib in 63%, pandas in 50%, scikit-learn in 26% and Seaborn in 24%.

Even when a notebook is "about" machine learning, NumPy and a chart library are almost always there.

Note: These are teaching notebooks, so they show what learning material uses (exactly the right signal for deciding what to learn first), not every line of production code.

Chart of the 20 most used pandas functions in 227 data science notebooks
The Fireblaze Notebook Count: 20 functions cover 63% of real pandas use.

The 4-Layer Python Ladder

The 4-Layer Python Ladder is a learning order for Python for data science where each layer only uses skills from the layers below it. You climb one layer at a time and finish each with a small project.

Layer Learn Skip for now Approx. hours
Layer 1: Core Python Variables, data types, lists, dictionaries, loops, if, functions, f-strings Classes, decorators, generators, recursion 15 to 20
Layer 2: NumPy and pandas Arrays, the 20 pandas functions above, missing values, groupby, merge MultiIndex tricks, performance tuning 15 to 20
Layer 3: Data visualization df.plot(), Matplotlib basics, Seaborn for quick statistical charts Interactive dashboards, animation 6 to 8
Layer 4: scikit-learn Train/test split, one model, cross-validation, a baseline Deep learning, hyperparameter search 8 to 10

Why this order? Because every pandas error message assumes you know lists and dictionaries, and every scikit-learn tutorial assumes you can prepare a DataFrame.

The 4-Layer Python Ladder for learning Python for data science
Climb one layer at a time. Each rung ends with a mini project.

Step #1: Set Up Python in 10 Minutes

The fastest setup for a beginner is Google Colab, because it runs in your browser with nothing to install. Google describes Colab as a hosted Jupyter Notebook service that needs no setup and is free of charge, though free resources are not guaranteed (Google Colab FAQ).

Pick one of these:

Option Best for What you need
Google Colab Absolute beginners, low-spec laptops A Google account and a browser
Anaconda + Jupyter Notebook Offline work, college labs A few GB of free disk space
Python + pip + VS Code Learners who also want software skills Comfort with installing packages

If you go local, install the latest stable Python. Python 3.15.0 was released in October 2026 (Python.org), but any version from 3.11 upward is fine for learning. Our Python pip installation guide walks through installing libraries step by step.

Google Colab notebook checking the pandas version for data science
One cell confirms your setup is ready.

Then run this in a notebook cell to check everything works:

import numpy, pandas, sklearn, matplotlib
print(pandas.__version__)

If it prints 3.0.x or higher, you're on the current pandas.

Pro tip: Use Jupyter Notebook or Colab, not a plain script, while learning. Seeing each result right under the code is how data people actually work.

Step #2: Core Python (Mini Project 1)

Core Python for data science means the building blocks pandas is made of: variables, lists, dictionaries, loops, conditions and functions. Our notebook count shows functions and for loops in almost half of all notebooks, so those two deserve the most practice.

Spend most of your time on:

  1. Variables and data types: int, float, str, bool. See variables in Python.
  2. Lists and dictionaries: a dictionary is basically one row of a table.
  3. Loops and conditions: practise with loops in Python.
  4. Functions: write small ones that take data in and return an answer. Our guide to functions in Python has 20+ examples.

Mini Project 1: A UPI expense tracker

Track a week of spending, total it by category, and find your biggest category. No libraries, just core Python:

expenses = [
    {"date": "2026-11-01", "category": "Food", "amount": 240},
    {"date": "2026-11-01", "category": "Travel", "amount": 60},
    {"date": "2026-11-02", "category": "Recharge", "amount": 299},
    {"date": "2026-11-03", "category": "Food", "amount": 180},
    {"date": "2026-11-04", "category": "Travel", "amount": 120},
]

totals = {}
for e in expenses:
    totals[e["category"]] = totals.get(e["category"], 0) + e["amount"]

def biggest_category(totals):
    return max(totals, key=totals.get)

print(totals)
print("Total spent: Rs", sum(totals.values()))
print("Biggest category:", biggest_category(totals))

Output:

{'Food': 420, 'Travel': 180, 'Recharge': 299}
Total spent: Rs 899
Biggest category: Food
Python list of dictionaries converted into a pandas DataFrame
Each dictionary becomes one row. That's why core Python comes first.

Notice the shape of expenses: a list of dictionaries. That's exactly what a pandas DataFrame looks like on the inside, which is why this layer comes first.

Your turn: replace the data with your real UPI history for one week and add a function that returns the average spend per day.

Step #3: NumPy and pandas (Mini Project 2)

NumPy and pandas are the two libraries that turn Python into a data tool. NumPy handles fast maths on arrays of numbers, and pandas gives you the DataFrame, a table with named columns that you filter, group and summarise.

Learn NumPy only to the level of creating arrays, basic maths (mean, sum, std) and boolean filtering. Then move to pandas and drill the 20 functions from the Notebook Count.

Mini Project 2: Which day do restaurant customers tip best?

This uses the classic tips dataset (244 restaurant bills). It practises read_csv, head, a new column, groupby and sort_values:

import pandas as pd

url = "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv"
tips = pd.read_csv(url)

tips["tip_pct"] = tips["tip"] / tips["total_bill"] * 100
summary = (tips.groupby("day")["tip_pct"]
               .agg(["mean", "count"])
               .sort_values("mean", ascending=False)
               .round(1))
print(summary)

Output:

      mean  count
day
Fri   17.0     19
Sun   16.7     76
Thur  16.1     62
Sat   15.3     87

Friday has the highest average tip, but look at the count column: only 19 Friday bills. Always check how many rows sit behind an average before you trust it. That one habit separates analysts from people who just run code.

pandas groupby output showing average tip percentage by day
Check the count column before trusting an average.

What changed in pandas 3.0 (and why old tutorials break)

pandas 3.0 was released on 21 January 2026 and changed two behaviours beginners hit early (pandas 3.0 release notes):

  • Text columns now use a dedicated str dtype instead of object. Older tutorials that check for object columns will not match.
  • Copy-on-Write is the default and only mode (pandas blog). So "chained assignment" no longer changes your data.

Here's the trap, tested on pandas 3.0.6:

df = pd.DataFrame({"city": ["Nagpur", "Pune", "Mumbai"],
                   "fees": [75000, 90000, 120000]})
print(df["city"].dtype)                        # str

df[df["city"] == "Pune"]["fees"] = 0           # does NOT change df
df.loc[df["city"] == "Pune", "fees"] = 85000   # does change df

pandas 3.0 raises a ChainedAssignmentError warning on the first line, and the fee stays at 90000. The .loc version works.

That's why .loc sits at No. 8 in our function count: you'll use it constantly.

Important: A tutorial that mentions SettingWithCopyWarning was written for pandas 2 or older, because pandas 3.0 removed that warning. Rewrite its assignments with .loc.

Step #4: Clean Real Indian Data (Mini Project 3)

Real Indian datasets are messy in a very specific way: numbers often use the Indian lakh comma style ("1,42,782") and percentages arrive as text ("70.86%"). Cleaning this kind of file is the most realistic beginner project you can do, because data cleaning is where most real analysis time goes.

We used the Lok Sabha 2014 state-wise turnout file published by DataMeet, an Indian open-data community (DataMeet on GitHub). Our question: in which states and union territories did women vote at a higher rate than men?

import pandas as pd

url = ("https://raw.githubusercontent.com/datameet/india-election-data/"
       "master/parliament-elections/election2014/state-wise-turnout.csv")
df = pd.read_csv(url)
print(df.dtypes.head(4))   # every column loads as str

num_cols = [c for c in df.columns if "Electors" in c or "Voters" in c]
pct_cols = [c for c in df.columns if "Turnout" in c]

for c in num_cols:
    df[c] = df[c].str.replace(",", "", regex=False).astype("int64")
for c in pct_cols:
    df[c] = df[c].str.rstrip("%").astype("float64")

df["gap"] = df["Female Turnout"] - df["Male Turnout"]
women_ahead = df[df["gap"] > 0].sort_values("gap", ascending=False)
print(len(women_ahead), "of", len(df), "rows")
print(women_ahead[["State", "Male Turnout", "Female Turnout", "gap"]].head(5))

What we found when we ran it:

State / UT Male turnout Female turnout Gap (pts)
Daman & Diu 74.33% 81.83% +7.50
Arunachal Pradesh 76.20% 81.02% +4.82
Goa 74.91% 79.11% +4.20
Lakshadweep 84.87% 88.42% +3.55
Dadra & Nagar Haveli 82.66% 85.71% +3.05

In 16 of the file's 35 states and union territories, female turnout beat male turnout. Maharashtra went the other way: 62.50% for men and 57.95% for women.

Notice how the file loaded: every column came in as text, because pandas can't read "1,42,782" as a number on its own. str.replace, str.rstrip and astype fixed it in three lines, all from the top-20 list.

Add a chart (Layer 3)

Data visualization is the layer that turns your answer into something a manager understands in five seconds. pandas has plot() built in, which is why it ranks No. 5 in our count:

import matplotlib.pyplot as plt

top = df.sort_values("gap").tail(10)
ax = top.plot.barh(x="State", y="gap", legend=False, figsize=(8, 5))
ax.set_xlabel("Female minus male turnout (percentage points)")
ax.set_title("Lok Sabha 2014: where women out-voted men")
plt.tight_layout()
plt.show()

Here's the chart that code produced:

Python bar chart of states where female voter turnout beat male turnout in 2014
Made with 6 lines of pandas and Matplotlib from the DataMeet turnout file.

Load, clean, summarise, chart: that loop is exploratory data analysis (EDA), and it's most of what junior analysts do every day. Once df.plot() feels easy, learn Seaborn for quick statistical charts like box plots and heatmaps.

Step #5: Your First Machine Learning Model (Mini Project 4)

scikit-learn is the Python library for classic machine learning, and it's the right last layer because it expects clean, numeric data from pandas. Your first goal is not a high score. It's beating a simple baseline honestly.

Mini Project 4: Predict Titanic survival

import pandas as pd
from sklearn.compose import make_column_transformer
from sklearn.dummy import DummyClassifier
from sklearn.impute import SimpleImputer
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_score
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import OneHotEncoder

url = "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/titanic.csv"
df = pd.read_csv(url)
X = df[["pclass", "sex", "age", "fare"]]
y = df["survived"]

prep = make_column_transformer(
    (OneHotEncoder(), ["sex"]),
    (SimpleImputer(strategy="median"), ["age", "fare", "pclass"]),
)
model = make_pipeline(prep, LogisticRegression(max_iter=1000))

print(cross_val_score(DummyClassifier(), X, y, cv=5).mean())
print(cross_val_score(model, X, y, cv=5).mean())
Titanic model accuracy compared with a baseline in scikit-learn
Beat the baseline first. Chase high scores later.

Our run (scikit-learn 1.9.1) gave 0.616 for the baseline that always guesses "did not survive", and 0.786 for logistic regression with 5-fold cross-validation. So four columns and one simple model add about 17 points of accuracy over guessing.

Want to understand what the model is doing? Read our guide to logistic regression in machine learning, then try other model families from types of machine learning.

Resource: When you finish these four, pick your next project from our list of 20 machine learning projects for beginners, each with a dataset link.

Your 6-Week Python Programming for Data Science Plan

The 6-week Python for data science plan below assumes 8 to 10 hours a week, which fits around college or a full-time job. Each week ends with something you can show.

Week Focus Practise Done when you can...
1 Setup + variables, types, lists 30 small exercises Write a list of 10 items and loop through it
2 Dictionaries, loops, functions Mini Project 1 Total any list of dictionaries by a key
3 NumPy basics + pandas read_csv, head, .loc, .iloc Load 3 CSVs Filter rows and pick columns without looking it up
4 groupby, merge, missing values, .str Mini Projects 2 and 3 Clean a messy Indian CSV and answer one question
5 Charts with df.plot(), Matplotlib, Seaborn Chart every project Explain a finding with one clear chart
6 scikit-learn basics Mini Project 4 Beat a baseline with cross-validation

Resource: Turn this table into a printable checklist and tick off each "Done when" item. If you can't do it without a tutorial open, repeat the week.

After week 6, add SQL and statistics, then build two portfolio projects on data you care about. If you prefer a guided path with trainer feedback, our Python course in Nagpur covers Layers 1 to 3, and the Data Science certification continues into machine learning.

Six-week Python for data science study plan with weekly mini projects
8 to 10 hours a week, one visible output every week.

5 Mistakes That Slow Beginners Down

Beginners learning Python for data science lose the most time to five mistakes:

  1. Learning "all of Python" first. Classes, decorators and generators appear in a small share of data notebooks. Learn them when a project needs them.
  2. Watching instead of typing. Pause every video and retype the code. Then change one thing and predict the result.
  3. Following pre-2026 pandas tutorials blindly. Chained assignment and object string checks behave differently in pandas 3.0.
  4. Skipping the "why". Every mini project should end with a sentence a non-coder understands, like "Friday tips look highest, but the sample is small."
  5. Jumping to deep learning. Get one honest scikit-learn model working before TensorFlow or PyTorch.

Now It's Your Turn

Python programming for data science is not about knowing every feature of the language. It's about core Python, about 20 pandas functions, one chart library and one honest model, practised on real data.

Start with Mini Project 1 today. It takes 20 minutes.

Which mini project are you going to try first?

FAQ

How much Python is needed for data science?

You need core Python (variables, lists, dictionaries, loops, conditions and functions) plus working knowledge of NumPy, pandas, one chart library and scikit-learn. In our count of 227 teaching notebooks, 20 pandas functions covered 63% of all pandas calls, so depth in a small toolkit matters more than breadth.

How long does it take to learn Python for data science?

Most beginners can finish the basics of Python programming for data science in about 6 weeks at 8 to 10 hours a week. Becoming job-ready usually takes a few more months, because you also need SQL, statistics and two or three portfolio projects.

Is Python enough to get a data science job?

No, Python alone is usually not enough. Employers also expect SQL, Excel, basic statistics and the ability to explain results clearly. Python is the core tool that connects all of these.

Can I learn Python for data science without a coding background?

Yes. Many data analysts in India come from commerce, science and arts backgrounds. Start with Google Colab so you skip installation, follow the 4-Layer Python Ladder, and finish one small project per layer.

Should I learn NumPy or pandas first?

Learn a little NumPy first, then spend most of your time on pandas. pandas is built on NumPy, so knowing arrays, basic maths and boolean filtering makes pandas errors easier to understand.

Sources

  1. TIOBE Index for November 2026, TechRepublic, 2026
  2. Stack Overflow 2025 Developer Survey highlights, App Developer Magazine, 2025
  3. Why Is Python So Popular in 2025?, JetBrains, 2025
  4. What's new in pandas 3.0.0, pandas, 2026
  5. pandas 3.0 released, pandas blog, 2026
  6. Python 3.15.0 release, Python.org, 2026
  7. Google Colab FAQ, Google, 2026
  8. India Election Data, DataMeet, accessed 2026
  9. seaborn-data (tips and titanic datasets), GitHub, accessed 2026
  10. Fireblaze Notebook Count: own analysis of 227 notebooks from 6 public GitHub repositories, 24 November 2026