mask and proper index

diego.avesani at gmail.com diego.avesani at gmail.com
Sun Feb 3 10:56:30 EST 2019


Dear all,

I am trying to apply a mask to my dataframe:

mask = (df['datatime'] > start_date) & (df['datatime'] <= end_date)
df = df.loc[mask]


It seems to work pretty well. 

After that I crate the cumulative of its element as:


PP_cumPP = np.cumsum(df[PP_station])


However, I am not able to compute PP_cumPP last element. Indeed, when I do

 len(PP_cumPP)

I get 

8783

and when I try to do:

PP_cumPP[len(PP_cumPP)-1]

I get an error.


What I am doing wrong?

Thanks a lot for any kind of help

Diedro




More information about the Python-list mailing list