I have some count-based data I would like to represent as a simple histogram. However, I would also like to group outlying points beyond a certain threshold into an 'overflow' bin. I'm unsure how to do this. Here is some sample data:
nums = np.random.randint(1,10,100)
nums = np.append(nums, [80, 100])
mydata = pd.DataFrame(nums)
mydata.hist(bins=20)
In this case, I'd want to group anything larger than 10 into the same bin. I initially thought of adjusting values beyond this threshold into the same value (i.e., 11), but I assume there is a more Pythonic way of doing this.


