Binning turns a numerical feature into categories by splitting its values into intervals. For example, passenger ages can be grouped into decade-wide buckets, giving a model room to learn that survival may vary across age groups rather than follow one simple trend. section 13.3
bins = [0, 10, 20, 30, 40, 50, 60, 70, 80] categorized_age = pandas.cut(preprocessed_data['Age'], bins) preprocessed_data['Categorized_age'] = categorized_age preprocessed_data = preprocessed_data.drop(["Age"], axis=1)
The Pandas example creates decade-wide age intervals, adds them as a feature, and removes the original age column. section 13.3




