Skip to main content
  1. Posts/

Polars scan_csv can now merge CSVs with different schemas

··144 words·1 min·

🧩 Polars can now read CSVs with missing columns in one call
#

The Polars scan_csv update is small but very practical: with missing_columns="insert", you can combine multiple CSV files even when they don’t share the exact same columns.

What stands out
#

  • 📥 Lazy loading for multiple CSVs
  • 🧷 Inserts missing columns as nulls
  • 🧼 Avoids schema errors on heterogeneous batches
  • ⚙️ Simplifies ingestion pipelines

It removes an annoying preprocessing step and makes irregular data much easier to handle.

🪄 Quick explanation
#

Think of several forms that are similar but not identical.

Polars can now line them up into one table without forcing you to fill everything in first.

👉 Simpler, more flexible, less code.

More information at the link 👇

Also published on LinkedIn.
Juan Pedro Bretti Mandarano
Author
Juan Pedro Bretti Mandarano