P3t*_*rus 6 python linear-regression
python中有一个库可以进行分段线性回归吗?我想自动为我的数据添加多行来得到这样的东西:

顺便说一句.我知道细分的数量.
大概numpy.piecewise()可以使用Numpy的工具。
更详细的描述如下:
How to apply stagewise Linear fit in Python?
如果这不是所需要的,那么您可能会在这些问题中找到一些有用的信息:
https://datascience.stackexchange.com/questions/8266/is-there-a-library-that-would-perform-segmented- Linear-regression-in-python
和这里:
https ://datascience.stackexchange.com/questions/8457/python-library-for-segmented-regression-aka-piecewise-regression