Top "Itertools" questions

A standard library module for Python with utilities for iterables.

More efficient way to get integer permutations?

I can get integer permutations like this: myInt = 123456789 l = itertools.permutations(str(myInt)) [int(''.join(x)) for x in …

python integer permutation itertools
N-D version of itertools.combinations in numpy

I would like to implement itertools.combinations for numpy. Based on this discussion, I have a function that works for 1…

python numpy combinatorics itertools
Prevent memory error in itertools.permutation

Firstly I would like to mention that i have a 3 gb ram. I am working on an algorithm that is …

python itertools
Python itertools.combinations: how to obtain the indices of the combined numbers

The result created by Python's itertools.combinations() is the combinations of numbers. For example: a = [7, 5, 5, 4] b = list(itertools.combinations(a, 2)) # …

python itertools
itertools.imap vs map over the entire iterable

I'm curious about a statement from http://docs.python.org/2/library/itertools.html#itertools.imap, namely it describes sum(imap(…

python python-2.x itertools
How to create a circular list of a given length from a list

I'm in need of a circular list. I have a list of 5 tags: taglist = ["faint", "shocking", "frosty", "loved", "sadness"] I …

python list slice itertools circular-list
All possible ways to interleave two strings

I am trying to generate all possible ways to interleave any two arbitrary strings in Python. For example: If the …

python permutation itertools
itertools product speed up

I use itertools.product to generate all possible variations of 4 elements of length 13. The 4 and 13 can be arbitrary, but as …

python numpy itertools
Itertools product without repeating duplicates

from itertools import product teams = ['india', 'australia', 'new zealand'] word_and = ['and'] tmp = '%s %s %s' items = [teams, word_…

python python-3.x unique combinations itertools