1 2 3
pwlf is a Python library for fitting continuous piecewise linear functions to data. Just specify the number of line segments you desire and provide the data.