Sharing 🐍 Python best practices, 📊 data science, ⚡tips & 🛠️ workflows (IDE, CI/CD, debugging).
🎯 Level up in data dev! 🚀
📺 YouTube: youtube.com/@z2d_io
⚙️ [ (pl.col("price") * s).alias(f"price_x{s}") for s in [1.1, 1.2, 1.3] ] → generate scaled columns dynamically
⚙️ [ (pl.col("price") * s).alias(f"price_x{s}") for s in [1.1, 1.2, 1.3] ] → generate scaled columns dynamically
🧩 pl.col("drink").str.starts_with("Latte") → flag latte drinks
🕒 pl.col("timestamp").dt.weekday() → extract weekday number
Fast, composable, and production-ready 💪
🧩 pl.col("drink").str.starts_with("Latte") → flag latte drinks
🕒 pl.col("timestamp").dt.weekday() → extract weekday number
Fast, composable, and production-ready 💪
❌ pl.col("price") * pl.col("quantity") -> shadowing
✅ (pl.col("price") * pl.col("quantity")).alias("revenue")
Build KPIs and metrics directly in with_columns([...]) — computed in parallel and clearly named.
❌ pl.col("price") * pl.col("quantity") -> shadowing
✅ (pl.col("price") * pl.col("quantity")).alias("revenue")
Build KPIs and metrics directly in with_columns([...]) — computed in parallel and clearly named.
pl.when(
pl.col("price") > 3
).then(
pl.lit("expensive")
).otherwise(
pl.lit("cheap)
)
→ replace if/else with fast, readable expressions
pl.when(
pl.col("price") > 3
).then(
pl.lit("expensive")
).otherwise(
pl.lit("cheap)
)
→ replace if/else with fast, readable expressions
Learn how to create & modify columns the Polars way using df.with_columns([...]).
▶️ Watch: www.youtube.com/watch?v=4jQO...
#Polars #Python #DataScience
Learn how to create & modify columns the Polars way using df.with_columns([...]).
▶️ Watch: www.youtube.com/watch?v=4jQO...
#Polars #Python #DataScience
... the Polars way:
🧩 pl.col() – expressive columns
🧮 .select() – choose/transform columns
🔍 .filter() – keep matching rows
Chaining:
df.filter(pl.col("city")=="Austin").select("drink","price")
▶️ Watch: youtu.be/gemLXW-hkJM
#Polars #Python #DataScience
... the Polars way:
🧩 pl.col() – expressive columns
🧮 .select() – choose/transform columns
🔍 .filter() – keep matching rows
Chaining:
df.filter(pl.col("city")=="Austin").select("drink","price")
▶️ Watch: youtu.be/gemLXW-hkJM
#Polars #Python #DataScience
In this new video, we create our first Polars DataFrame, build datasets, explore data, cover I/O with CSV and Parquet & uncover one common CSV pitfall beginners face.
▶️ Watch: youtu.be/kdZgrMHT23k?...
#Polars #Python #LearnDataScience #PolarsForBeginners
In this new video, we create our first Polars DataFrame, build datasets, explore data, cover I/O with CSV and Parquet & uncover one common CSV pitfall beginners face.
▶️ Watch: youtu.be/kdZgrMHT23k?...
#Polars #Python #LearnDataScience #PolarsForBeginners
Learn how to get Polars running in minutes.
We’ll install Polars, manage Python 3.13 with uv, and set up Jupyter for your first DataFrame.
▶️ Watch: youtu.be/HG9H5WimRwg?...
#Python #Polars #Setup
Learn how to get Polars running in minutes.
We’ll install Polars, manage Python 3.13 with uv, and set up Jupyter for your first DataFrame.
▶️ Watch: youtu.be/HG9H5WimRwg?...
#Python #Polars #Setup
• Use a decorator-factory pattern for flexible config
• Be friendly - add exponential backoff to avoid retry storms
• Don’t retry forever
Curious how you handle retries — do you build your own or rely on a library?
🔗 z2d.io/posts/produc...
#Python #DevTips
• Use a decorator-factory pattern for flexible config
• Be friendly - add exponential backoff to avoid retry storms
• Don’t retry forever
Curious how you handle retries — do you build your own or rely on a library?
🔗 z2d.io/posts/produc...
#Python #DevTips
Naive Python → ~48s
Polars-native → ~2.8s
That’s ~17× faster on 1M rows × 500-dim embeddings.
Full tutorial + code 👉 z2d.io/posts/polars...
#Python #Polars #DataScience #Vectorization
Naive Python → ~48s
Polars-native → ~2.8s
That’s ~17× faster on 1M rows × 500-dim embeddings.
Full tutorial + code 👉 z2d.io/posts/polars...
#Python #Polars #DataScience #Vectorization
2️⃣ Optimize: cast to `pl.Array` → unlocks Polars’ Rust engine for vector ops.
Result: same math, fully vectorized & much faster.
2️⃣ Optimize: cast to `pl.Array` → unlocks Polars’ Rust engine for vector ops.
Result: same math, fully vectorized & much faster.