git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mask and proper index


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