mask and proper index

Diego Avesani diego.avesani at gmail.com
Mon Feb 4 04:17:52 EST 2019


Dear all, Dear Peter,

thanks for you suggestions. Next time, I will try to set-up a proper example in order to post it and explain better my problem.
You understood perfectly what was my problem. Thanks a lot, indeed it seems to work.

If I can ask, due to the fact that I am new to thins kind of forum. 
In this moment, I have another problem related to the data I am working on. Should I write another post?
Should I do something else related to this post?

Thanks a lot again,
you are my lifesaver 






On Sunday, 3 February 2019 16:56:44 UTC+1, Diego Avesani  wrote:
> 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