fit piecewise linear data for a specified number of line segments
conda install conda-forge::pwlf
A library for fitting continuous piecewise linear functions to data. Just specify the number of line segments you desire and provide the data.