I have this df
:
CODE DATE MONTH_DAY PP PP_INTERPOL
0 472606FA 2001-01-01 01-01 0.0 0.0
1 472606FA 2001-01-02 01-02 0.0 0.1
2 472606FA 2001-01-03 01-03 0.7 0.5
3 472606FA 2001-01-04 01-04 NaN NaN
4 472606FA 2001-01-05 01-05 NaN NaN
... ... ... ... ...
248220 47E2A75C 2021-04-26 04-26 0.3 0.3
248221 47E2A75C 2021-04-27 04-27 0.5 0.4
248222 47E2A75C 2021-04-28 04-28 0.5 0.5
248223 47E2A75C 2021-04-29 04-29 0.8 0.8
248224 47E2A75C 2021-04-30 04-30 NaN NaN
I'm calculating some formulas for every code. So i did this code:
for code, data in df.groupby('CODE'):
rmsef1=np.sqrt(np.nanmean((data['PP']-interpolated_array1)**2))
rmsef2=np.sqrt(np.nanmean((data['PP']-interpolated_array2)**2))
rmsef3=np.sqrt(np.nanmean((data['PP']-interpolated_array3)**2))
rmsef4=np.sqrt(np.nanmean((data['PP']-interpolated_array4)**2))
rmsef5=np.sqrt(np.nanmean((data['PP']-interpolated_array5)**2))
.
.
.
.
rmsef20=np.sqrt(np.nanmean((data['PP']-interpolated_array20)**2))
rmses=np.array([rmsef1,rmsef2,rmsef3,rmsef4,
rmsef5,rmsef6,rmsef7,rmsef8,
rmsef9,rmsef10,rmsef11,rmsef12,
rmsef13,rmsef14,rmsef15,rmsef16,
rmsef17,rmsef18,rmsef19,rmsef20])
So i'll get as many rmses variables as the number of codes (rmses is a array of 20 float values). I want to plot all of this rmses in a same graphic (linear plot), something similar to this image:
So i'm not sure how or where i should use the plt.plot
. Or maybe i need to create another loop.
Would you mind to help me? Thanks in advance.