I have a Python dataframe with over 50 columns that looks like this:
x1 y1 x2 y2 ... x25 y25
1.8 21.3 1.6 21.8 ... 1.9 21.7
2.6 25.4 2.7 26.3 ... 2.8 27.8
3.5 30.4 3.6 32.1 ... 3.3 33.6
I want to use polyfit to find the slope of each pair of (x,y). That would mean that slope1 = np.polyfit(x1, y1, 1)[0], ..., slope25 = np.polyfit(x25, y25, 1)[0], and so on.
I am having a hard time figuring out how to proceed. Any help would be greatly appreciated. Thank you.