Session Ready
Exercise

Reordering categories in a Series

The owner of a local dog adoption agency has asked you take a look at her data on adoptable dogs. She is specifically interested in the size of the dogs in her dataset and wants to know if there are differences in other variables, given a dog's size. The adoptable dogs dataset has been loaded as dogs and the "size" variable has already been saved as a categorical column.

Instructions 1/4
undefined XP
  • 1
    • Print out the current categories of the "size" pandas Series.
    • 2
      • Reorder categories in the "size" column using the categories "small", "medium", "large", do not set the ordered parameter.
    • 3
      • Update the reorder_categories() method so that pandas knows the variable has a natural order.
    • 4
      • Add a argument to the method so that the "size" column is updated without needing to save it to itself.