Code QuizIntermediate Binning a Continuous Feature
Find why some values become NaN after binning ages.
Codepython
import pandas as pd
ages = pd.Series([5, 17, 25, 45, 70])
# Bucket ages into child / young / adult
bins = [0, 18, 35, 60]
labels = ['child', 'young', 'adult']
categories = pd.cut(ages, bins=bins, labels=labels)
print(categories)
What is the bug in this binning code?