I created this table using pandas' groupby function and want to extract each column as vector/array
df_duration_means = df.groupby('Duration').mean()
Interest | Loan amount | LTV | |
---|---|---|---|
Duration | |||
6 | 0.107500 | 274000.000000 | 0.652500 |
9 | 0.112500 | 510500.000000 | 0.580000 |
12 | 0.105345 | 276632.758621 | 0.595517 |
15 | 0.080000 | 81000.000000 | 0.678000 |
18 | 0.109167 | 516557.666667 | 0.455867 |
24 | 0.101500 | 374500.000000 | 0.554800 |
Now I want to extract a vector for each of the 4 columns (including duration). But I was not able to do it, even checking pandas documentation and all possible similar threads.
dur = df_duration_means.index
print(dur)
interest_mx = df_duration_means['Loan amount']
print(interest_mx)
So that I can plot each column vector vs the duration vector:
fig = plt.figure()
ax = fig.add_axes([0,0,1,1])
ax.plot(dur,in,color=)