Top "Itertools" questions

A standard library module for Python with utilities for iterables.

itertools.accumulate() versus functools.reduce()

In Python 3.3, itertools.accumulate(), which normally repeatedly applies an addition operation to the supplied iterable, can now take a function …

python itertools python-3.3 functools
Difficulty using Itertools cycle

At the moment I have defined many shapes in Turtle using begin_poly and end_poly then register_shape. I …

python list itertools turtle-graphics
Solving Puzzle in Python

I got one puzzle and I want to solve it using Python. Puzzle: A merchant has a 40 kg weight which …

python permutation combinations puzzle itertools
My IDLE does not recognize itertools.izip() as a function

>>> itertools.izip('ABCD', 'xy') Traceback (most recent call last): File "<pyshell#55>", line 1, in <module&…

python itertools
What is the purpose in Python's itertools.repeat?

Every use I can think of for Python's itertools.repeat() class, I can think of another equally (possibly more) acceptable …

python python-3.x itertools
implementing argmax in Python

How should argmax be implemented in Python? It should be as efficient as possible, so it should work with iterables. …

python itertools
Python creating a list with itertools.product?

I'm creating a list with itertools from a list of ranges, so far I have this: start_list = [xrange(0,201,1),xrange(0,201,2),…

python itertools
what is the quickest way to iterate through a numpy array

I noticed a meaningful difference between iterating through a numpy array "directly" versus iterating through via the tolist method. See …

python pandas numpy itertools
Python 3, module 'itertools' has no attribute 'ifilter'

I am new at Python, trying to build an old python file into Python 3. I got several build errors which …

python python-3.x itertools
itertools.groupby() not grouping correctly

I have this data: self.data = [(1, 1, 5.0), (1, 2, 3.0), (1, 3, 4.0), (2, 1, 4.0), (2, 2, 2.0)] When I run this code: for mid, group in itertools.groupby(self.data, key=…

python itertools