pitci.helpers.create_interval_buckets¶
-
pitci.helpers.create_interval_buckets(intervals_with_predictions, cut_function='qcut', **kwargs)[source]¶ Function to create a new column in a DataFrame that buckets all rows on the widthof the intervals in the DataFrame.
- Parameters
intervals_with_predictions (pd.DataFrame) – Data to add column too containing buckets of interval widths. Must have columns called “upper” and “lower” that gives the limits of the intervals for each row.
cut_function (str) – Type of bucketing to use, must be either cut or qcut. Decides the pandas cut function to use.
**kwargs (any) – Arbitrary keyword arguments to pass onto the pandas cut method.
- Returns
intervals_with_predictions – Input data with new column called “interval_width_bucket” that splits the data on the width of the intervals in the data (defined by the “lower” and “upper” columns)
- Return type
pd.DataFrame