Grouping Numbers into Bins
pd.cut sorts numbers into labelled ranges (bins), turning a number into a category. pd.qcut makes bins with equal counts (quantiles). Combine with value_counts for a quick histogram of a column.
Examplepython
Quick check
What does `pd.cut` do?
Your turn: write the code
Bin the marks into 'fail' (0 to 49) and 'pass' (50 to 100) and print how many of each.
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.