5. Data manipulation: Part II#

We introduce other methods in pandas that you can use to manipulate your data:

  • Working with categorical data

  • Converting column data types

  • Create a new categorical column from a numeric column

  • Reshaping data

  • Joining data

  • Handling missing data

5.1. Categorical data#

Categoricals have fixed and limited possible values or categories. Consider this example: We may have a column representing marital status of the individual:

  • Never married

  • Cohabiting

  • Married

  • Divorced

  • Widowed

import numpy as np import pandas as pd

data_frame = pd.DataFrame({}) pd.DataFrame({“A”: [“a”, “b”, “c”, “a”]})