Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6502

Kernel died while using itertools.combinations

$
0
0

I am using itertools.combinations to generate all possible combinations of elements of a list. However kernel always dies after 2 minutes. I assume it's a memory issue. Is there any other efficient way to produce all possible combinations and store it in some data structure?

total = ['E', 'ENE', 'ESE', 'N', 'NNE', 'NNW', 'NW', 'S', 'SE', 'SSE',
       'SSW', 'SW', 'W', 'WNW', 'WSW', 'station_0', 'station_1',
       'station_2', 'station_3', 'station_4', 'station_5', 'station_6',
       'station_7', 'station_8', 'station_9', 'station_10', 'year',
       'month', 'day', 'hour', 'SO2', 'NO2', 'CO', 'O3', 'TEMP', 'PRES',
       'DEWP', 'RAIN', 'WSPM']            

total_combinations = []           

for i in range(2,len(total)+1):
    current_comb = list(combinations(total,i))
    total_combinations = total_combinations + current_comb


Viewing all articles
Browse latest Browse all 6502

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>