sys.exc_info

2017-06-28 Thread Steven D'Aprano
sys.exc_info() returns three items: (exception type, exception value, traceback) https://docs.python.org/2/library/sys.html#sys.exc_info https://docs.python.org/3/library/sys.html#sys.exc_info and may be used something like this example: try: something except: exc_type, exc, tb = sy

Re: Combining 2 data series into one

2017-06-28 Thread Bhaskar Dhariyal
On Wednesday, 28 June 2017 23:43:57 UTC+5:30, Albert-Jan Roskam wrote: > (sorry for top posting) > Yes, I'd try pd.concat([df1, df2]). > Or this: > df['both_names'] = df.apply(lambda row: row.name + ' ' + row.surname, axis=1) > > From: Python-list on > behalf of

Re: Create a list of dates for same day of week in a year

2017-06-28 Thread Michael F. Stemper
On 2017-06-28 18:30, Sayth Renshaw wrote: Thoughts or examples? dateutil.rrule is what you may use e.g. In [44]: days[:5], days[-5:] Out[44]: ([datetime.datetime(2017, 6, 28, 23, 58, 11), datetime.datetime(2017, 7, 3, 23, 58, 11), datetime.datetime(2017, 7, 5, 23, 58, 11), datetim

Re: A Good Tutorial on Python Decorators

2017-06-28 Thread Marko Rauhamaa
Steve D'Aprano : > When you run Javascript in your browser, you allow anonymous, > untrusted third-parties to run code on your PC. Yes. I'm running NoScript on my browser, but I believe JavaScript (or equivalent) is the way forward. I *love* my Turing Tarpit. Aus dem Paradies, das [Turing] un

Re: Create a list of dates for same day of week in a year

2017-06-28 Thread Sayth Renshaw
> > Thoughts or examples? > > > dateutil.rrule is what you may use e.g. > > > In [38]: from dateutil import rrule > > In [39]: from datetime import date

RE: Error

2017-06-28 Thread justin walters
On Jun 28, 2017 1:47 PM, "Ken R. Lewis" wrote: Hello! I am running a script, and it comes up with an error. What can I do to make the error be corrected? I am thinking it is something with the data, possibly. I have only had Python for a few days, so maybe I copied some codes wrong. Also,

Re: How to build a simple neural network in 9 lines of Python code

2017-06-28 Thread sohcahtoa82
On Tuesday, June 27, 2017 at 12:31:49 PM UTC-7, John Ladasky wrote: > On Tuesday, June 27, 2017 at 9:24:07 AM UTC-7, Sam Chats wrote: > > https://medium.com/technology-invention-and-more/how-to-build-a-simple-neural-network-in-9-lines-of-python-code-cc8f23647ca1 > > OK, that's cheating a bit, usin

Re: A Good Tutorial on Python Decorators

2017-06-28 Thread D'Arcy Cain
On 06/28/17 17:59, Steve D'Aprano wrote: On Thu, 29 Jun 2017 01:56 am, Peter Pearson wrote: (Blushing) Thanks. Life is getting difficult for us JavaScript paranoids. Its not paranoia if they're really out to get you. https://www.cnet.com/news/javascript-opens-doors-to-browser-based-attacks/

Re: Syntax error for simple script

2017-06-28 Thread Erik
On 28/06/17 03:46, Steve D'Aprano wrote: All of this is irrelevant if beginners don't read the error message. "if". End-users don't read error messages, no matter how well written they are, Reference? and every word you add probably cuts the number of people reading it by half. "probabl

Re: A Good Tutorial on Python Decorators

2017-06-28 Thread Steve D'Aprano
On Thu, 29 Jun 2017 01:56 am, Peter Pearson wrote: > (Blushing) Thanks. Life is getting difficult for us JavaScript paranoids. Its not paranoia if they're really out to get you. https://www.cnet.com/news/javascript-opens-doors-to-browser-based-attacks/ https://www.proofpoint.com/us/corporate-b

Re: Error

2017-06-28 Thread Nathan Ernst
Not sure if this is the cause of your error, but the value for the variable "user" is misspelled according to the preceding comment. "admim" vs "admin" (not the M instead of an N at the end). Regards, Nathan On Wed, Jun 28, 2017 at 3:08 PM, Ken R. Lewis wrote: > Hello! > > I am running a script

Re: DJANGO cannot import name _compare_digest

2017-06-28 Thread Xristos Xristoou
i dont have 'operator.py' in my system only 'test_operator.py' and 'fix_operator.py' if : import sys print sys.modules['operator'] i get this : that say me how to rename it? -- https://mail.python.org/mailman/listinfo/python-list

RE: Error

2017-06-28 Thread Ken R. Lewis
Hello! I am running a script, and it comes up with an error. What can I do to make the error be corrected? I am thinking it is something with the data, possibly. I have only had Python for a few days, so maybe I copied some codes wrong. Also, does Python have a way to save files download

Re: DJANGO cannot import name _compare_digest

2017-06-28 Thread Thomas Jollans
On 28/06/17 21:52, Xristos Xristoou wrote: > > > hello i have python 7.13 > > DJANGO 1.11.2 version > > django-crypto 0.20 version on windows 10. > > i want to create a DJANGO app but anytime to try to migrate i take > > that error : > > from django.utils.crypto import get_random_string

DJANGO cannot import name _compare_digest

2017-06-28 Thread Xristos Xristoou
hello i have python 7.13 DJANGO 1.11.2 version django-crypto 0.20 version on windows 10. i want to create a DJANGO app but anytime to try to migrate i take that error : from django.utils.crypto import get_random_string File "C:\Python27\lib\site-packages\django\utils\crypto.py", line 8

memoryview handling deallocated memory

2017-06-28 Thread djd
>From C I'm creating a memoryview object that wraps memory that is not under my >control and will be deallocated when the C function creating the memoryview >and passing it into Python returns. In Python 3.5 I can invoke `memoryview.release()` to handle this situation but I'm not seeing any equ

Re: Combining 2 data series into one

2017-06-28 Thread Albert-Jan Roskam
(sorry for top posting) Yes, I'd try pd.concat([df1, df2]). Or this: df['both_names'] = df.apply(lambda row: row.name + ' ' + row.surname, axis=1) From: Python-list on behalf of Paul Barry Sent: Wednesday, June 28, 2017 12:30:25 PM To: Bhaskar Dhariyal Cc: python

Re: Mouse position values

2017-06-28 Thread Grant Edwards
On 2017-06-28, jorge.conr...@cptec.inpe.br wrote: > I have 3D data array and would like to plot arbitrary cross section > by cliking in my image. I was an IDL user and in IDL we have a > cursor.pro that I used to get the X and Y positions on my image. I > would like know how can I get the values

Re: A Good Tutorial on Python Decorators

2017-06-28 Thread Peter Pearson
On Tue, 27 Jun 2017 16:43:38 +, Andre Müller wrote: > Peter Pearson schrieb am Di., 27. Juni 2017 um > 18:35 Uhr: > >> On Tue, 27 Jun 2017 15:10:53 + (UTC), Saurabh Chaturvedi wrote: >> > https://opensource.google.com/projects/py-decorators-tutorial >> >> "No Results found." >> > Activate

Mouse position values

2017-06-28 Thread jorge . conrado
Hi, I have 3D data array and would like to plot arbitrary cross section by cliking in my image. I was an IDL user and in IDL we have a cursor.pro that I used to get the X and Y positions on my image. I would like know how can I get the values of the X an Y position for two points (A and B) in

Re: Combining 2 data series into one

2017-06-28 Thread Bhaskar Dhariyal
On Wednesday, 28 June 2017 18:01:19 UTC+5:30, Paul Barry wrote: > Maybe look at using .concat instead of + > > See: > http://nbviewer.jupyter.org/github/jakevdp/PythonDataScienceHandbook/blob/master/notebooks/03.06-Concat-And-Append.ipynb > > On 28 June 2017 at 13:02, Paul Barry wrote: > > > >

EuroPython 2017: On-desk Rates and Day Passes

2017-06-28 Thread M.-A. Lemburg
We will be switching to the on-desk rates for tickets on Monday next week (July 3rd), so this is your last chance to get tickets at the regular rate, which is about 30% less than the on-desk rate. * EuroPython 2017 Tickets * https://ep2017.europython.eu/en/regist

Re: Combining 2 data series into one

2017-06-28 Thread Paul Barry
Maybe look at using .concat instead of + See: http://nbviewer.jupyter.org/github/jakevdp/PythonDataScienceHandbook/blob/master/notebooks/03.06-Concat-And-Append.ipynb On 28 June 2017 at 13:02, Paul Barry wrote: > > Maybe try your code on a sub-set of your data - perhaps 1000 lines of > data? -

Re: Combining 2 data series into one

2017-06-28 Thread Paul Barry
Maybe try your code on a sub-set of your data - perhaps 1000 lines of data? - to see if that works. Anyone else on the list suggest anything to try here? On 28 June 2017 at 12:50, Bhaskar Dhariyal wrote: > No it didn't work. I am getting memory error. Using 32GB RAM system > > On Wed, Jun 28, 2

asyncio: no current event loop in thread 'MainThread'

2017-06-28 Thread caulagi
I am trying to write a test for a function using asyncio. Can I mix using unittest.TestCase and asyncio.test_utils.TestCase? When I do that, the loop in test_utils.TestCase seems to affect the other code I have. This is a simplified example - $ pip freeze py==1.4.34 pytest==3.1.2 $ cat test_fo

Re: Combining 2 data series into one

2017-06-28 Thread Paul Barry
On the line that's failing, your code is this: combinedX=combinedX+dframe['tf'] which uses combinedX on both sides of the assignment statement - note that Python is reporting a 'MemoryError", which may be happening due to this "double use" (maybe). What happens if you create a new dataframe,

Re: Combining 2 data series into one

2017-06-28 Thread Bhaskar Dhariyal
On Wednesday, 28 June 2017 14:43:48 UTC+5:30, Paul Barry wrote: > This should do it: > > >>> import pandas as pd > >>> > >>> df1 = pd.DataFrame(['bhaskar', 'Rohit'], columns=['first_name']) > >>> df1 > first_name > 0bhaskar > 1 Rohit > >>> df2 = pd.DataFrame(['dhariyal', 'Gavval'], col

Re: How to build a simple neural network in 9 lines of Python code

2017-06-28 Thread Gregory Ewing
Steve D'Aprano wrote: It should be obvious that if you allow the use of external libraries that can contain arbitrary amounts of code, *without* counting that external code towards your measure of code complexity, you get a bogus measurement of code complexity. Numpy isn't really doing a lot he

Re: Combining 2 data series into one

2017-06-28 Thread Paul Barry
This should do it: >>> import pandas as pd >>> >>> df1 = pd.DataFrame(['bhaskar', 'Rohit'], columns=['first_name']) >>> df1 first_name 0bhaskar 1 Rohit >>> df2 = pd.DataFrame(['dhariyal', 'Gavval'], columns=['last_name']) >>> df2 last_name 0 dhariyal 1Gavval >>> df = pd.DataFrame

Re: Syntax error for simple script

2017-06-28 Thread Steven D'Aprano
On Wed, 28 Jun 2017 09:51:17 +0200, Adriaan Renting wrote: > it would be nice if it was specific enough that if you put it in a > search engine you get relevant results explaining things. You mean like this? https://duckduckgo.com/?q=SyntaxError%3A+Missing+parentheses+in+call+to+%27print%27 h

Re: Syntax error for simple script

2017-06-28 Thread Adriaan Renting
Adriaan Renting| Email: rent...@astron.nl Software Engineer Radio Observatory ASTRON | Phone: +31 521 595 100 (797 direct) P.O. Box 2 | GSM: +31 6 24 25 17 28 NL-7990 AA Dwingeloo | FAX: +31 521 595 101 The Netherlands| Web: http://www.astron.nl/