I run association rules using efficient_apriori package in Python. I need to save results. My idea is:
- convert rules into pandas df
- save df to hdf5.
Problem is that I have 4 bilions of rules. And following code crashes on signal 9: SIGKILL:
data = [dict(**rule.__dict__, confidence=rule.confidence, support=rule.support) for rule in rules] # HERE MY CODE CRASHES!!!!!
vystup_df = pd.DataFrame(data)
ROZDELENI = 11
n = math.ceil(len(vystup_df) / ROZDELENI)
for i in range(ROZDELENI):
uloz = vystup_df.loc[i*n : i*n+n]
uloz.to_hdf('rules.h5', key='uloz', mode='a')
How can I improve my code, please? I need to save results by small parts I think, but I don`t know how. Thanks