Re: Loop with else clause

2019-02-04 Thread DL Neil
On 5/02/19 8:12 PM, Steve wrote: Would it be a hyphythonitical question? Is that one of the new meta-classes in release 3.99, or a perhaps a project to remove the GIL and take advantage of multi-core architectures? As well as embarrassing the poor coder, this question vexed quite a few mind

RE: Loop with else clause

2019-02-04 Thread Steve
Would it be a hyphythonitical question? = Footnote: Zamboni locks up after running into large patch of loose teeth. -Original Message- From: Python-list On Behalf Of DL Neil Sent: Monday, February 4, 2019 11:29 PM To: 'Python' Subject: Loop with else clause What is the

Loop with else clause

2019-02-04 Thread DL Neil
What is the pythonic way to handle the situation where if a condition exists the loop should be executed, but if it does not something else should be done? Why am I asking? Today's code review included a for...else structure. I've rarely seen such a thing, and even knowing it exists, cannot r

Re: Implement C's Switch in Python 3 [OT languages]

2019-02-04 Thread DL Neil
On 4/02/19 9:25 PM, Christian Gollwitzer wrote: Am 04.02.19 um 09:18 schrieb Christian Gollwitzer: I think English is quite "unique" with writing out the ending of the ordinals attached to arabic numerals. Of course, there is a Wikipedia page about it: https://en.wikipedia.org/wiki/Ord

Re: Python program to phone?

2019-02-04 Thread Chris Roy-Smith
On 5/2/19 7:20 am, Steve wrote: I have written my first python program (600 lines!) to help control my blood sugar and it has been so successful that my A1c dropped form 9.3 to an impressive 6.4. It will be much more useful if I had it on my phone. (MotoG, Android) The .py file reads/writes to

RE: pandas read dataframe and sum all value same month and year

2019-02-04 Thread Avi Gross
Diego, If your goal is to sum data by month, there are more general methods than you making lists of starting and ending dates. ONE way to consider in your case that is easy to understand is to add a derived column/feature to your data such as the first 7 characters of the date as perhaps a routi

Re: format number is not recognized in a cycle

2019-02-04 Thread Diego Avesani
Dear all, Dear Peter, could you suggest me one? Thanks a lot, Diego On Monday, 4 February 2019 13:58:17 UTC+1, Diego Avesani wrote: > Dear all, > > I have this dataframe: > > datatime,T,RH,PSFC,DIR,VEL10,PREC,RAD,CC,FOG > 2012-01-01 06:00, 0.4,100, 911,321, 2.5, 0.0, 0, 0,0 > 2012-01-01

Python program to phone?

2019-02-04 Thread Steve
I have written my first python program (600 lines!) to help control my blood sugar and it has been so successful that my A1c dropped form 9.3 to an impressive 6.4. It will be much more useful if I had it on my phone. (MotoG, Android) The .py file reads/writes to two txt files. About a year ag

Re: format number is not recognized in a cycle

2019-02-04 Thread Peter Otten
Diego Avesani wrote: > Dear Peter, Deal all, > > Trying different options, I manage this solution: > >mask = (df['datatime'] > str(start_date[ii])) & (df['datatime'] <= >str(end_date[ii])) > > As you can notice, I have put str before start_date[ii]) and end_date[ii]. > > What do you t

Re: pandas read dataframe and sum all value same month and year

2019-02-04 Thread Diego Avesani
Deal all, following Peter's suggestion, I put the example code: import pandas as pd import numpy as np from datetime import datetime #input: start_date = np.array(["2012-01-01 06:00",'2013-01-01 06:00','2014-01-01 06:00']) end_date = np.array(["2013-01-01 05:00",'2014-01-01 05:00','2015-01-0

Re: format number is not recognized in a cycle

2019-02-04 Thread Diego Avesani
Dear Peter, Deal all, Trying different options, I manage this solution: mask = (df['datatime'] > str(start_date[ii])) & (df['datatime'] <= str(end_date[ii])) As you can notice, I have put str before start_date[ii]) and end_date[ii]. What do you think? Thanks On Monday, 4 February 20

Re: format number is not recognized in a cycle

2019-02-04 Thread Peter Otten
Diego Avesani wrote: > this is the code: While the example is fine now it runs without error over here, on rather old versions of pandas (0.13.1) and numpy (1.8.2). Therefore I'm out of the debugging cycle for now. -- https://mail.python.org/mailman/listinfo/python-list

[RELEASE] Python 3.8.0a1 is now available for testing

2019-02-04 Thread Ɓukasz Langa
I packaged my first release. *wipes sweat off of face* Go get it here: https://www.python.org/downloads/release/python-380a1/ Python 3.8.0a1 is the first of four planned alpha releases of Python 3.8, the next feature release of Python. During the alpha phase, Python 3.8 remains under heavy devel

Re: format number is not recognized in a cycle

2019-02-04 Thread Diego Avesani
Dear Peter, thanks a lot for your patience. this is the code: import pandas as pd import numpy as np from datetime import datetime #input: start_date = np.array(["2012-01-01 06:00",'2013-01-01 06:00','2014-01-01 06:00']) end_date = np.array(["2013-01-01 05:00",'2014-01-01 05:00','2015-01-0

pandas read dataframe and sum all value same month and year

2019-02-04 Thread Diego Avesani
Dear all, I am reading the following data-frame: datatime,T,RH,PSFC,DIR,VEL10,PREC,RAD,CC,FOG 2012-01-01 06:00, -0.1,100, 815,313, 2.6, 0.0, 0, 0,0 2012-01-01 07:00, -1.2, 93, 814,314, 4.8, 0.0, 0, 0,0 2012-01-01 08:00, 1.7, 68, 815,308, 7.5, 0.0, 41, 11,0 2012-01-01 09:00, 2.4, 65

Re: format number is not recognized in a cycle

2019-02-04 Thread Peter Otten
Diego Avesani wrote: > Dear all, > > I have this dataframe: > > datatime,T,RH,PSFC,DIR,VEL10,PREC,RAD,CC,FOG > 2012-01-01 06:00, 0.4,100, 911,321, 2.5, 0.0, 0, 0,0 > 2012-01-01 07:00, 0.8,100, 911,198, 0.8, 0.0, 0, 22,0 > 2012-01-01 08:00, 0.6,100, 912, 44, 1.2, 0.0, 30, 22,0 > 20

format number is not recognized in a cycle

2019-02-04 Thread Diego Avesani
Dear all, I have this dataframe: datatime,T,RH,PSFC,DIR,VEL10,PREC,RAD,CC,FOG 2012-01-01 06:00, 0.4,100, 911,321, 2.5, 0.0, 0, 0,0 2012-01-01 07:00, 0.8,100, 911,198, 0.8, 0.0, 0, 22,0 2012-01-01 08:00, 0.6,100, 912, 44, 1.2, 0.0, 30, 22,0 2012-01-01 09:00, 3.1, 76, 912, 22, 0.8,

Re: mask and proper index

2019-02-04 Thread Peter Otten
Diego Avesani wrote: > 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? You should start a new thread for a new problem, even if for you it is part of the same project

Re: mask and proper index

2019-02-04 Thread Diego Avesani
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

Re: Implement C's Switch in Python 3 [OT languages]

2019-02-04 Thread Christian Gollwitzer
Am 04.02.19 um 09:18 schrieb Christian Gollwitzer: I think English is quite "unique" with writing out the ending of the ordinals attached to arabic numerals. Of course, there is a Wikipedia page about it: https://en.wikipedia.org/wiki/Ordinal_indicator So I was wrong and the abbrevi

Re: Implement C's Switch in Python 3 [OT languages]

2019-02-04 Thread Christian Gollwitzer
Am 04.02.19 um 04:11 schrieb DL Neil: > On 4/02/19 10:00 AM, Christian Gollwitzer wrote: Am 03.02.19 um 09:32 schrieb DL Neil: Now back to ordinal dates - the "st", "th", etc suffixes only work in English. You'd need another list (but no great coding complexity) to cope with a second, third, ..