'Creating two histograms with unified bins in python in categorical data
I have a couple of datasets that I would like to process into histogram form, but I'm finding no clear or easy way to build a common set of shared bins between the distributions or histograms. Is there a way I can do this? At the moment I am using the following:
engines_a = df_a[df_a['engine'] == 'abc']['category'].value_counts()
engines_b = df_b[df_b['engine'] == 'def']['category'].value_counts()
np.histogram(engines_a, density=True)
np.histogram(engines_b, density=True)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
