To learn Python for data analysis, spend one to two weeks on core Python (variables, loops, functions, lists and dictionaries), then move quickly into pandas: loading CSV files, selecting and filtering, cleaning, grouping, merging and plotting. Practise on a real dataset in Jupyter or Google Colab. You do not need advanced programming to start. You need enough Python to work comfortably with tables of data.
What to learn, in order
1. Python basics (1 to 2 weeks)
- Variables, numbers, strings, booleans.
- Lists, dictionaries, tuples and sets.
- if statements, for loops, comprehensions.
- Functions and importing libraries.
- Reading error messages. This is a skill in itself.
2. The tools (a day)
Install Anaconda or use Google Colab, which needs no install. Learn to use Jupyter notebooks: cells, running order, restarting the kernel. Notebooks make it easy to write code, see output and add notes.
3. pandas (3 to 4 weeks)
pandas is the central library for tabular data. The DataFrame is your spreadsheet in code. Learn these in order:
- Load data: pd.read_csv, read_excel; inspect with head, info, describe, shape.
- Select columns and rows: df["col"], loc and iloc, boolean filtering.
- Create and change columns; rename; sort; drop duplicates.
- Handle missing values: isna, fillna, dropna, and when each is appropriate.
- Fix types: dates with pd.to_datetime, numbers stored as text, categories.
- Group and aggregate: groupby with agg, pivot_table, value_counts.
- Combine tables: merge (like SQL JOIN), concat.
- Work with strings and dates: the .str and .dt accessors.
- Reshape: melt, pivot.
4. Visualisation (1 to 2 weeks)
Start with the plotting built into pandas, then matplotlib and seaborn. Learn which chart answers which question: histogram for distribution, line for time, bar for comparison, scatter for relationship. Label axes and titles.
5. Beyond the basics
NumPy for arrays, SciPy or statsmodels for tests and regression, scikit-learn if you move toward machine learning, and SQL access with SQLAlchemy or the built-in sqlite3 module.
A practice plan
| Week | Focus | Mini-task |
|---|---|---|
| 1 to 2 | Core Python | Write a function that cleans a list of messy strings |
| 3 | Load and inspect | Load a CSV of your choice and describe every column |
| 4 | Select, filter, sort | Answer ten questions about the data |
| 5 | Clean | Fix dates, missing values and duplicates; document what you did |
| 6 | Group and merge | Summarise by category; join a second table |
| 7 | Plot | Make four clear charts that tell one story |
| 8 | Project | End-to-end analysis with a written conclusion |
Where to find data
- Kaggle datasets and competitions.
- Government open data portals for your country.
- Sports, film and music data that interest you.
- Your own data: bank exports, fitness trackers, reading logs.
- Messy datasets are better teachers than tidy ones.
Habits that make code stick
- Type code yourself. Copy and paste teaches little.
- Read the documentation. The pandas user guide is clear and has examples.
- When you get stuck, describe the problem in a sentence before searching or asking an AI. Often that is enough to see the answer.
- Rebuild a finished exercise from a blank notebook a week later.
- Keep a personal cheat sheet of snippets in your own words.
Use of AI assistants
AI coding assistants can speed you up, but they can also stop you learning. A good rule is to attempt the problem yourself for ten minutes first, ask for hints before solutions, and always run and read any code you are given. Check it against a small example whose answer you can work out by hand.
Remembering syntax and concepts
The method names and options in pandas are easy to forget. Spaced flashcards for things like the difference between loc and iloc, merge types, or what groupby returns help. Type to Study can build a Python or data analysis course from a topic or from a book or notes you upload and turn the key terms into flashcards and typed questions. It is a memory and study aid and does not run code, so use it alongside a notebook.
Finish with a project
Choose a question, collect the data, clean it, analyse it, visualise it and write a one-page summary. Publish the notebook on GitHub. Together with SQL and a dashboard project, this is the core of an entry-level analyst portfolio.