I am trying to create combination of 34 items. when I limit max combinations to 10, there are no problems. however when I try to get the combination of more, I am having memory error. (MemoryError: Unable to allocate X GiB for an array with shape (X, Y) and data type float64) I am already using 64bit python, what would help with the iteration of these?
import pandas as pd
import itertools as it
header = [100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134]
combs= []
max_combinations = 20
for i in range(1, len(header)+1):
if i < max_combinations:
print (i)
els = [list(x) for x in it.combinations(header, i)]
combs.extend(els)
df1 = pd.DataFrame({0: combs})