liveBook · Manning

Data conversion

As explained in Statistics Every Programmer Needs

Data type conversion is the process of changing values from one representation or data type to another.

Data type conversion changes values into representations that downstream analysis can use. For machine learning, categorical strings such as venue and play type are mapped to numeric codes. section 6.2.2

A practical conversion workflow:

  • Define explicit mappings: Road becomes 0 and Home 1; Run becomes 0 and Pass 1. section 6.2.2

Football play data

Mapping venue and play type produces numeric predictors, while the resulting table contains integer and floating-point columns suitable for decision trees and random forests.

How Statistics Every Programmer Needs covers it

How deep it goes
Demonstrates explicit mappings, conditional sign changes, and dtype inspection, but does not compare encoding strategies.
Examples
Uses Road/Home and Run/Pass mappings plus offensive-team score-differential sign normalization.
What it assumes
Assumes pandas DataFrame operations and categorical football-play fields.
What you can do after
Apply it via pandas map and inspect converted columns with DataFrame.info().
How it connects
Connects categorical data with machine learning, decision trees, random forests, and derived variables.

Also explained in

Compare how 21 books explain data conversion →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Statistics Every Programmer Needs. The section links point to the parts of the book it draws on.