このモジュールの関数の戻り値は、全てイテレータとなる点に、注意が必要です。
-
count() -
cycle() -
repeat() -
accumulate()
iterableな要素を結合する
chain()
>>> from itertools import chain
>>> dict1 = {'m/z': [1, 2, 3], 'intensity': [0, 10, 10]}
>>> dict2 = {'m/z': [4, 5, 6], 'intensity': [10, 0, 20]}
>>> for i in chain(dict1['m/z'], dict2['m/z']):
... print(i)
...
1
2
3
4
5
6
cahin.from_iterable()compress()dropwhile()filterfalse()groupby()starmap()takewhile()
イテラブルなオブジェクトから、イテレータを作る
tee()
>>> itertools.tee(dict1, 1)
(<itertools.tee object at 0x10912a200>,)
-
zip_longest() -
product() -
permutations() -
combinations() -
combinations_with_replacement()