Pandas to_html cannot apply style

2017-10-30 Thread zljubisic
Hi, the following code never applies style and I cannot figure out why. Can someone please help? import pandas as pd def function2(row): if row.A == True: color = '#FF' else: color = '#00FF00' background_color = 'background-color: {}'.format(color) return [b

Re: Invoking return through a function?

2017-10-30 Thread Christian Gollwitzer
Am 30.10.17 um 01:42 schrieb Steve D'Aprano: On Mon, 30 Oct 2017 03:35 am, Alberto Riva wrote: And as Bartc pointed out, we already have this situation with exceptions, so it would be nothing new. Pardon me, but it was *me* who pointed out the analogy with exceptions, not Bart. But this is dif

Re: Pandas to_html cannot apply style

2017-10-30 Thread Thomas Jollans
On 30/10/17 08:44, zljubi...@gmail.com wrote: > Hi, > > the following code never applies style and I cannot figure out why. > Can someone please help? > > import pandas as pd > > def function2(row): > if row.A == True: > color = '#FF' > else: > color = '#00FF00' > >

pandas finding field difference between two dataframes

2017-10-30 Thread zljubisic
Hi, I have to compare two pandas dataframes and find difference between each row. For example, in the code bellow, rows with index 0 and 3 are intentionally different. Row 0 is different in field A, and row 3 is different in field 3. After merging dataframes, I can concentrate to the dfm with d

Re: Pandas to_html cannot apply style

2017-10-30 Thread zljubisic
> This is not an in-place operation: it returns a style which you can then > render. > > style = df.style.apply(function2, axis=1) > html = style.render() > > appears to work. This was a missing link. Thank you very very much Thomas. Regards and best wishes. -- https://mail.python.org/mailm

Re: from packaging import version as pack_version ImportError: No module named packaging

2017-10-30 Thread David Gabriel
Dears, When I run this command I got this error message: ubuntu@orchestrateur:/tmp/pack$ virtualenv -p $(which python3.5) . Running virtualenv with interpreter /usr/local/sbin/. Traceback (most recent call last): File "/usr/bin/virtualenv", line 3, in virtualenv.main() File "/usr/lib/pyt

Re: Pandas to_html cannot apply style

2017-10-30 Thread zljubisic
> This is not an in-place operation: it returns a style which you can then > render. > > style = df.style.apply(function2, axis=1) > html = style.render() > > appears to work. After your suggestion, rows are properly colored, but now I have lost all table lines, font is smaller... Is there an o

Re: from packaging import version as pack_version ImportError: No module named packaging

2017-10-30 Thread Peter Otten
David Gabriel wrote: > Dears, > > When I run this command I got this error message: > > ubuntu@orchestrateur:/tmp/pack$ virtualenv -p $(which python3.5) . > Running virtualenv with interpreter /usr/local/sbin/. > Traceback (most recent call last): > File "/usr/bin/virtualenv", line 3, in >

Re: why it append one more letter after decode?

2017-10-30 Thread ROGER GRAYDON CHRISTMAN
On Sun, Oct 29, 2017 11:06 PM, Ho Yeung Lee wrote: > if run these function to decode in python interactive console, >it can decode correct, > >but when run with a big project, it append a letter Y > > >On Monday, October 30, 2017 at 9:48:36 AM UTC+8, Ho Yeung Lee wrote: >> def leftrotate(l, n): >>

Performance of map vs starmap.

2017-10-30 Thread Kirill Balunov
Sometime ago I asked this question at SO [1], and among the responses received was paragraph: - `zip` re-uses the returned `tuple` if it has a reference count of 1 when the `__next__` call is made. - `map` build a new `tuple` that is passed to the mapped function every time a `__next__` call is

request.post in If condition

2017-10-30 Thread sourav voip
Hi All, I'm trying to hit request.post with condition using if-else as below... I;m posting the full script here...as I've tried declaring post url details tested with multiple places. -- https://mail.python.org/mailman/listinfo/python-list

Re: request.post in If condition

2017-10-30 Thread sourav voip
Hi All, I'm trying to hit request.post with condition using if-else as below... I;m posting the full script here...as I've tried declaring post url details tested with multiple places.. If condition for disk utiliztion is working perfect ,however request.post is not hitting. Please suggest any hi

Re: right list for SIGABRT python binary question ?

2017-10-30 Thread M.-A. Lemburg
n 25.10.2017 11:51, Karsten Hilbert wrote: > On Tue, Oct 24, 2017 at 08:47:58PM +0200, M.-A. Lemburg wrote: > This error suggests that you have 32- and 64-bit versions of Python and mxDateTime mixed in your installation. Py_InitModule4 is only available in the 32-bit build of >

Re: Invoking return through a function?

2017-10-30 Thread Rhodri James
On 29/10/17 16:45, Alberto Riva wrote: On 10/29/2017 11:13 AM, bartc wrote: (What the OP wants was also proposed a few weeks back in comp.lang.c. But that was only within nested functions, so if H is inside G, and G is inside F, then a 'returnall' from H would return directly directly from F

Getting started with python

2017-10-30 Thread subhendu . panda93
Hi, Could you please help me with the below if possible: 1. Best site to go ahead for python. 2. How python is different from other languages and future scope of it. 3. Tasks that are getting done using python in present. 4. Link where I can be able to get python videos, ebooks from basics to exp

Re: Getting started with python

2017-10-30 Thread Bill
subhendu.pand...@gmail.com wrote: Hi, Could you please help me with the below if possible: Possible and reasonable are two different things. Why don't you try some web searches and try to answer some of your own questions. I offer this advice as a Python newbe myself. Bill 1. Best si

Re: Coding style in CPython implementation

2017-10-30 Thread Rhodri James
On 28/10/17 19:42, Στέφανος Σωφρονίου wrote: Greetings everyone. I have noticed that in many if conditions the following syntax is used: a) if (variable == NULL) { ... } b) if (variable == -1) { ... } c) if (variable != NULL) { ... } What I wanted to ask is, is there a particular reason for no

pythonw.exe error

2017-10-30 Thread George Kalamaras via Python-list
When I am running IDLE return to me Missing python36.dll error Στάλθηκε από την Αλληλογραφία για Windows 10 -- https://mail.python.org/mailman/listinfo/python-list

Re: pythonw.exe error

2017-10-30 Thread Igor Korot
Hi, On Oct 30, 2017 11:27 AM, "George Kalamaras via Python-list" < python-list@python.org> wrote: When I am running IDLE return to me Missing python36.dll error Στάλθηκε από την Αλληλογραφία για Windows 10 Could you please translate this from Greek? Thank you. -- https://mail.python.org/m

Re: pythonw.exe error

2017-10-30 Thread Rustom Mody
On Monday, October 30, 2017 at 10:11:49 PM UTC+5:30, Igor Korot wrote: > Hi, > > > > On Oct 30, 2017 11:27 AM, "George Kalamaras via Python-list" wrote: > > When I am running IDLE return to me Missing python36.dll error > > Στάλθηκε από την Αλληλογραφία για Windows 10 > > > Could you please

Re: right list for SIGABRT python binary question ?

2017-10-30 Thread Karsten Hilbert
On Mon, Oct 30, 2017 at 02:02:25PM +0100, M.-A. Lemburg wrote: > PS: Please CC me on replies as I don't regularly read c.l.p anymore. Sure. > >> Could you check whether you have similar import errors with > >> other modules that have C extensions ? E.g. lxml. > >> > >> What you're seeing appears

Re: from packaging import version as pack_version ImportError: No module named packaging

2017-10-30 Thread Cameron Simpson
On 30Oct2017 10:48, David Gabriel wrote: When I run this command I got this error message: ubuntu@orchestrateur:/tmp/pack$ virtualenv -p $(which python3.5) . [...] OSError: [Errno 13] Permission denied Peter has explained this failure. Note that in the shell you can show command execution,

Re: Vim, ctags jump to python standard library source

2017-10-30 Thread Cameron Simpson
On 19Oct2017 12:08, Matt Schepers wrote: I prefer to use vim and ctags when developing python, but I'm having trouble getting ctags to index the standard library. Sometimes I would like to see an object's constructor etc... Does anyone know how to do this? Will "ctags -o your-tags-file -a -R

Re: [Tutor] request.post in If condition

2017-10-30 Thread Mike Miller
What do you mean when you say it is not hitting? Is there a specific error, or are you saying it simply isn't posting to your site? Mike On Mon, Oct 30, 2017, 8:21 AM sourav voip wrote: > Hi All, > > I'm trying to hit request.post with condition using if-else as below... > I;m posting the full

Re: Invoking return through a function?

2017-10-30 Thread Alberto Riva
On 10/30/2017 10:27 AM, Rhodri James wrote: On 29/10/17 16:45, Alberto Riva wrote: On 10/29/2017 11:13 AM, bartc wrote: (What the OP wants was also proposed a few weeks back in comp.lang.c. But that was only within nested functions, so if H is inside G, and G is inside F, then a 'returnall'

Re: Invoking return through a function?

2017-10-30 Thread Alberto Riva
On 10/30/2017 12:23 AM, Rustom Mody wrote: On Sunday, October 29, 2017 at 9:52:01 PM UTC+5:30, Rick Johnson wrote: On Sunday, October 29, 2017 at 9:19:03 AM UTC-5, Alberto Riva wrote: In a language like Lisp Python is nothing like Lisp, and for good reason! Sure, we have a few lispers and f

Re: Invoking return through a function?

2017-10-30 Thread Steve D'Aprano
On Tue, 31 Oct 2017 01:06 pm, Alberto Riva wrote: > On 10/30/2017 10:27 AM, Rhodri James wrote: [...] >> You can do the same in C.  I've had the displeasure of trying to >> maintain such code.  It was near-unreadable, because it constantly broke >> your expectations of what the code flow *could* b

Re: Invoking return through a function?

2017-10-30 Thread Rustom Mody
On Tuesday, October 31, 2017 at 7:45:18 AM UTC+5:30, Alberto Riva wrote: > On 10/30/2017 12:23 AM, Rustom Mody wrote: > > On Sunday, October 29, 2017 at 9:52:01 PM UTC+5:30, Rick Johnson wrote: > >> On Sunday, October 29, 2017 at 9:19:03 AM UTC-5, Alberto Riva wrote: > > > >>> In a language like L

Re: Invoking return through a function?

2017-10-30 Thread Chris Angelico
On Tue, Oct 31, 2017 at 2:00 PM, Steve D'Aprano wrote: > Python has no GOTO, fortunately, but C has at least two, GOTO and LONGJMP. A C > macro could, if I understand correctly, jump into the middle of another > function. (Yay for spaghetti code!) No, I don't think you do understand them correctl

Re: Invoking return through a function?

2017-10-30 Thread Rick Johnson
Steve D'Aprano wrote: > > [...] > > I suppose it wouldn't be too awful if macros required > dedicated syntax, so at least you could distinguish between > "this is a safe, ordinary function" and "this is a macro, > it could mean anything". In the same spirit, i've been trying in vain for *YEARS*

Re: Invoking return through a function?

2017-10-30 Thread Steve D'Aprano
On Tue, 31 Oct 2017 02:34 pm, Chris Angelico wrote: > On Tue, Oct 31, 2017 at 2:00 PM, Steve D'Aprano > wrote: >> Python has no GOTO, fortunately, but C has at least two, GOTO and LONGJMP. >> A C macro could, if I understand correctly, jump into the middle of another >> function. (Yay for spaghet

Re: Invoking return through a function?

2017-10-30 Thread Steve D'Aprano
On Tue, 31 Oct 2017 02:26 pm, Rustom Mody wrote: > My own feeling about lisp-macros is conflicted: > - They are likely the most unique feature of lisp, putting it at the top of > the blub-language tower > - They are the single reason Lisp can never succeed like mainstream > languages: Any signific