'Finding the inflection point in pandas DataFrame

I have a two column DataFrame with just a list of numbers in x and then a monotonically decreasing -but not constant- set of numbers in column y

data

    x        y
0   1   600.000000
1   2   222.361705
2   3   139.820496
3   4   114.353763
4   5   90.807283
5   6   80.022188
6   7   72.193116
7   8   62.309712
8   9   55.362476
9   10  47.335051
10  11  42.821741
11  12  40.540734
12  13  37.758571

What I'd like to try is find for what x value is the inflection point in y. I've tried a few different methods of people asking similar but not quite the same question, but they're not quite working.

dy = np.diff(data.y) 
idx_max_dy = np.argmax(dy)

But I know that's not right, and I'm running into dimensionallity problems. Any suggestions would be appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source