liveBook · Manning

Python

As explained in Learn AI Data Engineering

Python is a general-purpose programming language widely used for automation, data processing, and artificial-intelligence applications.

Python is used as a practical data-engineering language for tasks that are awkward in SQL: calling APIs, parsing nested JSON, and applying complex regular expressions. Its step-by-step workflows suit iterative work with a coding companion, which can generate templates, refine logic, and help with repetitive transformations while the developer verifies the result. section 4.0

A local Python workflow is run in Jupyter Lab. This supports trying code incrementally, inspecting outputs, and following complete examples alongside SQL tooling and AI-powered tasks. section 1.4

Extract phone numbers with regex

Use Python's re module to find phone numbers written in several formats within one text block. A regex passed to re.findall returns the matches, including parenthesized, hyphenated, and dotted forms such as (212) 555-7890, 646-123-4567, and 917.555.1234. section 4.3.1

import re
 
text = """
Call me at (212) 555-7890. My backup number is 646-123-4567. You can also reach me at 917.555.1234.
"""
 
# Regex to match U.S. phone numbers
phone_numbers = re.findall(r'\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}', text)
print(phone_numbers)

The listing shows a small, runnable pattern: store raw text, define a regex for optional punctuation and spacing, then print the list returned by re.findall. section 4.3.1

Python also supports API-driven cleanup and analysis. A workflow can retrieve brewery records, select fields, normalize phone numbers, and extract website domains with regex. API documentation can be supplied to a coding companion as prompt context, but results are meant to be checked in a notebook. section 4.4

For data quality work, Python and pandas implement explicit transformations such as detecting nulls, enforcing formats, mapping values, and creating columns. AI-driven validation can sit alongside those techniques through the Chat Completions API: define the expected cleaned fields, serialize records, prompt for rules, and process rows individually rather than submitting an entire dataset at once. section 6.0 section 6.4

Typical Python data-cleaning operations include:

  • Detect invalid email, SKU, and date formats with regex and format rules. section 6.4
  • Flag or remove missing, negative, and out-of-range values with pandas and standard Python logic. section 6.4
  • Normalize state names, truncate descriptions, combine names, and map products into categories. section 6.4

How Learn AI Data Engineering covers it

How deep it goes
Works through runnable regex and cleaning tasks, while deferring broader Python language fundamentals.
Examples
Uses phone-number extraction, brewery API cleanup, and surf-shop order validation examples.
What it assumes
Assumes a local environment and teaches workflows through installed Jupyter Lab, PostgreSQL, and pgAdmin tooling.
What you can do after
Apply it via Jupyter Notebook, pandas, regex, and a coding companion to clean and analyze data.
How it connects
Connects Python with Jupyter Lab, regular expressions, APIs, pandas, SQL, and the Chat Completions API.

Also explained in

Compare how 28 books explain Python →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn AI Data Engineering. The section links point to the parts of the book it draws on.