pd.cut is called with bins 0, 10 and 20 and right=False. Which interval does the value 10 fall into?
Correct answer
B. The interval from 10 up to 20, because right=False makes bins left-closed
15 views
B. The interval from 10 up to 20, because right=False makes bins left-closed
15 views
cut is right-closed by default, so bins look like (0, 10], and right=False flips that to [0, 10), placing the boundary value 10 in the second interval. include_lowest=True is needed to capture the very lowest value, which the open left edge normally excludes. Unlike qcut, cut uses fixed numeric edges rather than equal-count quantiles.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is B? Ask here and get an explanation.