A function to calculate the number of bins to be used for a subset of a data source, based on the full dataset provided. The bin width is calculated using the Freedman–Diaconis rule.
n_bins = calculate_bins(data, data_split)
full column vector for data to be binned
subsection of the data which the number of bins will be calculated for
number of bins for the data_split value