internalsGet Pro

Module 02 · Lesson 3 of 8Pro

pandas for preparing ML data

Level
Beginner
Topic
Python for machine learning
Reading time
14 min

When you finish this page you can

  1. Measure a table’s real memory and shrink repeated text columns with the category type.
  2. Keep category codes the same between training and scoring by fixing the list of categories.
  3. Join two tables without silently adding or losing rows, and prove it with a check.
  4. Change values in a table with one .loc call, and hand the model a numeric array in a fixed column order.
  1. Data, features and labels14 min
  2. NumPy: arrays and vectorized maths14 min

The join that added 12,000 orders

is our example online store. Farah, an ML engineer, prepares its data in a free : a sample of about 1 million orders from 200,000 customers, across 50,000 products. The prediction is : which customers will stop buying, so Joseph’s growth team can send them a voucher on Monday.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan