pandas.cut() is used to bin values into discrete intervals. For instance,
pd.cut(
np.array([0.2, 0.25, 0.36, 0.55, 0.67, 0.78]),
3,
include_lowest=True,
right=False
)
Out[9]:
[[0.2, 0.393), [0.2, 0.393), [0.2, 0.393), [0.393, 0.587), [0.587, 0.781), [0.587, 0.781)]
Categories (3, interval[float64]): [[0.2, 0.393) < [0.393, 0.587) < [0.587, 0.781)]
How can I achieve the same in PySpark? I had a look to QuantileDiscretizer but it's definitely not the equivalent of pd.cut() as it does not return the intervals.