Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Principle:Eventual Inc Daft Column Input Normalization

From Leeroopedia


Knowledge Sources
Domains Utilities, API_Design
Last Updated 2026-02-08 14:00 GMT

Overview

Pattern for normalizing heterogeneous column input types (strings, Expression objects, iterables) into a uniform list of Expression objects at DataFrame API boundaries.

Description

DataFrame APIs commonly accept column references in multiple forms: bare strings (`"name"`), Expression objects (`col("name")`), single values, or iterables of mixed types. Column Input Normalization converts all these forms into a canonical `list[Expression]` before the operation proceeds, eliminating type-checking boilerplate from every DataFrame method.

Usage

Apply this principle at the top of any DataFrame operation that accepts column references. This enables the flexible API that users expect (passing strings, expressions, or lists interchangeably) while keeping the internal implementation simple.

Theoretical Basis

This is an instance of the Adapter pattern: a normalization layer translates multiple input representations into a single internal representation. The type alias `ManyColumnsInputType = ColumnInputType | Iterable[ColumnInputType]` defines the contract, and the normalization functions enforce it.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment