Series Posts

Conceptual Python for Java Developers: From Streams to Tensors

Part 0: Python for Java Developers: From Streams to Tensors

A 10-part, example-driven Python series for seasoned Java and C# developers moving into data science, ML and AI. Follow Arjun, a Java architect pulled into a fraud-detection ML project, from culture shock to PyTorch.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 0: Master Outline

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time

Conceptual Python for Java Developers: From Streams to Tensors

Part 1: "The Culture Shock" — Names, Objects and the Runtime

Arjun's first Python code review goes badly. We cover how Python executes code, why variables are names bound to objects, mutability and aliasing, is vs ==, truthiness, numeric surprises, modules, and a proper project setup with uv.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 1: Welcome to Planet Python — Your First Mission

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time

Conceptual Python for Java Developers: From Streams to Tensors

Part 2: "Collections Without Ceremony" — Lists, Dicts, Sets and Comprehensions

The Streams API, translated. Lists, tuples, dicts and sets; slicing and unpacking; comprehensions as the idiomatic map/filter/collect; sorting with keys; and the collections module — Counter, defaultdict, deque — applied to transaction data.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 2: The Planet of Memory Vaults — Variables and Data Types

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time

Conceptual Python for Java Developers: From Streams to Tensors

Part 3: "Functions Are Values" — Arguments, Closures and Decorators

No more single-method interfaces. Positional, keyword, *args and **kwargs; the mutable-default trap; lambdas; closures and LEGB scoping; and decorators — Python's ten-line answer to Spring AOP — for timing, retries and caching.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 3: The Crossroads of the Cosmos — Making Decisions

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time

Conceptual Python for Java Developers: From Streams to Tensors

Part 4: "Objects Without the Ceremony" — Classes, Dunders, Dataclasses and Protocols

Arjun writes a Java-style Transaction class with getters and setters and gets gently mocked. Properties, the Python data model (__repr__, __eq__, __hash__, __len__, __getitem__), @dataclass, class methods, inheritance, enums, and duck typing formalised with Protocol.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 4: The Looping Nebula — Repeating Actions

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time

Conceptual Python for Java Developers: From Streams to Tensors

Part 5: "The Lazy River" — Iterators, Generators and Context Managers

A 40 GB transaction export will not fit in memory. The iterator protocol, generators and yield, lazy generator pipelines, itertools, exceptions and EAFP, pathlib and csv, and with-statements as Python's try-with-resources.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 5: Mission Control Functions — Reusable Commands

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time

Conceptual Python for Java Developers: From Streams to Tensors

Part 6: "Types Strike Back" — Type Hints, Pydantic and Modern Tooling

Arjun misses his compiler. Type hints and what they do (and do not) do at runtime, generics, TypedDict, mypy, runtime validation with Pydantic, project layout with pyproject.toml, ruff, pytest and logging — the Maven-and-JUnit toolkit for Python.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 6: The Treasure Chest — Lists, Tuples, and Strings

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time

Conceptual Python for Java Developers: From Streams to Tensors

Part 7: "Thinking in Arrays" — NumPy, Vectorisation and Broadcasting

Why the for loop is the enemy of numeric Python. The ndarray and its memory model, dtypes, vectorised operations, axes, boolean masks, broadcasting rules, views vs copies, NaN handling, random generators, and cosine-similarity search from scratch.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 7: The Alien Encyclopedia — Dictionaries

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time

Conceptual Python for Java Developers: From Streams to Tensors

Part 8: "DataFrames for SQL Minds" — pandas in Practice

pandas explained through SQL. Series, DataFrames and the Index; selection with loc and iloc; filtering; groupby as GROUP BY and transform as a window function; merge as JOIN; time series and rolling windows; missing data; Copy-on-Write; and building a fraud feature table.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 8: The Captain's Log — Reading and Writing Files

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time

Project Python for Java Developers: From Streams to Tensors

Part 9: "The First Model" — scikit-learn, Pipelines and Honest Metrics

Sentinel's first fraud model. The estimator API, stratified train/test splits, Pipeline and ColumnTransformer, logistic regression vs random forests, why accuracy lies on imbalanced data, precision-recall and threshold tuning, cross-validation, data leakage, and persisting models.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 9: Space Shields Up — Handling Errors

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time

Project Python for Java Developers: From Streams to Tensors

Part 10: "Into the Deep End" — PyTorch, Concurrency and the AI Toolkit

Tensors, autograd and a hand-written PyTorch training loop. Then the questions a Java architect asks: the GIL, threads vs processes, asyncio for fanning out LLM calls, embeddings and semantic search, validated structured output, and how Python models reach JVM services.

Conceptual The Adventures of Ava the Astronaut: Learning Python One Planet at a Time.

Part 10: The Grand Mission — Capstone Project

The Adventures of Ava the Astronaut: Learning Python One Planet at a Time