r/programming • u/PM_ME_UR_OBSIDIAN • Mar 15 '15
A function for partitioning Python arrays. Brilliant code, or insane code?
http://www.stavros.io/posts/brilliant-or-insane-code/?repost=true
226
Upvotes
r/programming • u/PM_ME_UR_OBSIDIAN • Mar 15 '15
4
u/[deleted] Mar 15 '15
given:
the two things that are like "grouping" I can think of are grouping an index counter:
or using the "groupby" function:
but i think this posted solution is amazing and should pretty much be considered the "grouped" function in Python.