pyufunc.get_layer_boundary#

pyufunc.get_layer_boundary(df, x_col_name, y_col_name, base_interval=1, percentile=0.85)#

Get the boundary values of the target column based on the base column values.

Notes

  • x_col_name also known as x axis in 2D space, y_col_name also known as y axis in 2D space.

  • The boundary values are calculated based on the max value of the target column

    for each interval of the base column values.

  • The interval is defined by the base_interval parameter.

  • The percentile parameter is used to calculate the boundary values based on

    the max value of the target column for each interval.

Parameters:
  • df (pd.DataFrame) – the input dataframe

  • x_col_name (str) – x column name

  • y_col_name (str) – y column name

  • base_interval (int) – interval for selecting boundary value. Defaults to 1.

  • percentile (float) – percentile value for each boundary. Defaults to .85.

Example

>>> import pandas as pd
>>> import numpy as np
>>> from pyufunc import get_layer_boundary
>>> df = pd.DataFrame({'x': np.random.randint(0, 100, 100),
...                    'y': np.random.rand(100)})
>>> get_layer_boundary(df, 'x', 'y', base_interval=1, percentile=.85)
Raises:

Exception – if x_col_name or y_col_name is not in the dataframe columns

Returns:

a dataframe with the boundary values of the target column based on the base column values.

Return type:

pd.DataFrame