Python conciseness confuses me -


i have been looking @ pandas: run length of nan holes, , code fragment comments in particular:

series([len(list(g)) k, g in groupby(a.isnull()) if k])  

as python newbie, impressed conciseness not sure how read this. short along lines of

mylist = [] k, g in groupby(a.isnull()) :     if k:         mylist.append(len(list(g))) series(mylist) 

in order understand going on trying play around error:

list object not callable 

so not luck there.

it lovely if shed light on this.

thanks, anne

you've got translation correct. however, code give cannot run because a free variable.

my guess getting error because have assigned list object name list. don't that, because list global name type of list.

also, in future please provide full stack trace, not 1 part of it. please provide sufficient code at least there no free variables.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -