Comment on A look at some of Python's useful itertoolsparentComments−shavenwarthog213ySeconded. I use itertools constantly for data-wrangling on network server and web applications. Specifically:- processing files with imap and ifilter to rapidly grab data, find a subset of it, then process it with a function- defaultdict(list) is incredibly useful for collecting data, arranging it by a certain key (like date or object id), then collecting into a list- namedtuple is occasionally useful for efficiently stuffing data into an object with a few named attributes.
Comments
Seconded. I use itertools constantly for data-wrangling on network server and web applications. Specifically:
- processing files with imap and ifilter to rapidly grab data, find a subset of it, then process it with a function
- defaultdict(list) is incredibly useful for collecting data, arranging it by a certain key (like date or object id), then collecting into a list
- namedtuple is occasionally useful for efficiently stuffing data into an object with a few named attributes.