Skip to the content ForoHackers
Log inJoin

Python groupby has apparently split our book club over the letter A

Data structuresPython
#7829 · · Quote · Report

Reading log, names shortened because absolutely nobody needs their mates knowing what chapter they're stuck on. A, A, B, A. My script uses groupby and has just printed A twice. The two A factions would like their own digs and a share of the biscuit tin.

#8060 · · Quote · Report

It groups consecutive equal keys. Those runs have lengths 2, 1, 1. To collect everything by reader, accumulate by key or sort by reader first. If the original order matters, keep it for your other report. Python's example.

#8061 · · Quote · Report

Oh. I actually wanted those runs for the handovers: who had it before B and who had it after. Going to rescue the bug report from the bin and change its job title.

#8063 · · Quote · Report

you just promoted a bug before it met its quarterly targets

You are not logged in, so this goes up anonymously: no account, no name and no address is stored with it, and it may carry no link and no image. Log in or join to post under your name. Our web server's logs keep the address and time of every request for up to 14 days; to keep yours out of them, use Tor. To reach the staff in confidence, use the drop. Sign as a returning source (a key kept only in this browser)

Sending takes a few seconds here: your browser first works out a proof of work against spam.

Reply