Tutorials

Tutorials

Practical, hands-on tutorials and how-to guides on Python, Pandas, NumPy, SQL, and setting up your data-science environment.

Python

NLP Preprocessing in Python: From Raw Text to a TF-IDF Vector

Every NLP task starts with the same unglamorous work: cutting text into tokens, cleaning them up, and converting them into numbers. This guide walks through tokenization, normalization, stemming vs lemmatization, and bag-of-words/TF-IDF vectorization with NLTK and scikit-learn.

July 3, 2026 · 13 min read ·By Mehdi Lotfinejad Read tutorial →
Python Pandas and JSON: A Practical Guide to Nested Data and Large Files Real JSON is rarely a flat table. This guide builds a tree-to-table mental model for pandas' JSON tools, then works through json_normalize on nested records and reading JSON Lines files with lines=True and chunksize so a file far bigger than memory still processes cleanly. Jul 3, 2026 13 min read Read tutorial SQL Pandas and SQLite: A Practical Guide to read_sql and to_sql sqlite3 gets you a connection; pandas turns that connection into a two-way door for DataFrames. This guide builds the mental model, then works through read_sql_query, groupby analysis, to_sql, and parameterized queries on a small hardware-store database you can reproduce yourself. Jul 3, 2026 10 min read Read tutorial Python PySpark for Beginners: A Practical Guide to Your First Spark DataFrame A hands-on introduction to PySpark for people who already know pandas: install it locally, build the mental model for why a Spark DataFrame behaves so differently, and run select, filter, withColumn, and groupBy against a real local Spark session. Jul 3, 2026 11 min read Read tutorial Python Python datetime: A Practical Guide to Parsing, Formatting, and Time Math Timestamps are everywhere in real code, but strptime, strftime, and timedelta are easy to mix up. This guide builds a point-and-duration mental model, then works through creating, parsing, formatting, date arithmetic, and basic timezone-awareness on a small delivery-tracking scenario you can reproduce yourself. Jul 3, 2026 10 min read Read tutorial Python Python Dictionaries: A Practical Guide to Keys, Values, and Lookups A dictionary is how Python stores anything you'd look up by name instead of position. This guide builds the key-value mental model, then works through creating, reading, updating, and iterating dictionaries on a small bookshop inventory you can type in yourself. Jul 3, 2026 9 min read Read tutorial Python Python Lambda Functions: A Practical Guide to When They Help A lambda is just a def function with the name and return keyword stripped away, built for the one case where you'd throw the function away right after using it. This guide builds that mental model, then works through sorted(), map(), filter(), and pandas .apply() on a small task backlog you can type in yourself. Jul 3, 2026 11 min read Read tutorial Python Python Libraries for Data Cleaning: What pandas Alone Won't Cover pandas covers most data-cleaning jobs, but not all of them. This guide surveys three libraries worth keeping in your toolbox — numpy for vectorized numeric fixes, re for pattern-based text cleaning, and rapidfuzz for catching near-duplicate rows exact matching can't see — each demonstrated on one small, reproducible dataset. Jul 3, 2026 12 min read Read tutorial Python Python Regex: A Practical Guide to Extracting and Cleaning Messy Text Messy ticket subjects, log lines, and free-text fields all hide structured data. This guide builds a pattern-then-question mental model for Python's re module, then works through groups, findall, sub, and re.compile on a support-ticket inbox you can reproduce yourself. Jul 3, 2026 11 min read Read tutorial Python Reading Files in Python: A Practical Guide to Text, CSV, and JSON Before you reach for pandas or any other library, it helps to know what Python is actually doing when it reads a file. This guide builds a mental model for three file shapes, then works through open(), csv.reader, csv.DictReader, and json.load on a small set of example files you write and read yourself. Jul 3, 2026 10 min read Read tutorial
Sponsor

Keep DATATWEETS free. Help fund practical data, AI, and engineering lessons for learners worldwide.

Buy Me a Coffee at ko-fi.com