Top "Itertools" questions

A standard library module for Python with utilities for iterables.

How do I use itertools.groupby()?

I haven't been able to find an understandable explanation of how to actually use Python's itertools.groupby() function. What I'm …

python itertools
Permutations between two lists

I’m having trouble wrapping my head around a algorithm I’m try to implement. I have two lists and …

python list algorithm itertools combinatorics
importing izip from itertools module gives NameError in Python 3.x

I am trying to import the izip module like so: from itertools import izip However after recently changing over from …

python python-3.x python-2.7 itertools izip
When is it better to use zip instead of izip?

When is it better to use zip instead of itertools.izip?

python-2.7 python-2.x itertools
How to apply itertools.product to elements of a list of lists?

I have a list of arrays and I would like to get the cartesian product of the elements in the …

python itertools cartesian-product
Python how to read N number of lines at a time

I am writing a code to take an enormous textfile (several GB) N lines at a time, process that batch, …

python lines itertools
permutations with unique values

itertools.permutations generates where its elements are treated as unique based on their position, not on their value. So basically …

python permutation itertools
Python merging two lists with all possible permutations

I'm trying to figure out the best way to merge two lists into all possible combinations. So, if I start …

python list itertools
Remove duplicate tuples from a list if they are exactly the same including order of items

I know questions similar to this have been asked many, many times on Stack Overflow, but I need to remove …

python list duplicates tuples itertools
itertools not defined when used inside module

I save my custom functions in a separate module that I can call when I need to. One of my …

python function module anaconda itertools