python - Issue in generating all permutations of columns in a dataframe in Ipython -


i working in ipython , trying generate permutations of columns present in dataframe. issue have 15 columns in dataframe , code doesn't reach end , keeps on executing. here current code:

df = pd.read_csv(filename, sep = ';', error_bad_lines=false)  def all_perms(str):     if len(str) <=1:         yield str     else:         perm in all_perms(str[1:]):             in range(len(str)):                 #nb str[0:1] works in both string , list contexts                 yield perm[:i] + str[0:1] + perm[i:]  allperms_list = [] p in all_perms(df.columns[:len(df.columns)]):     allperms_list.append(p)  

i followed this example. have 16 core , 32gb memory system , have been running code last 1.5 hours still executing , doesn't reaching end. there fundamental issue in code have? how can make run faster without affecting final result? read itertools.permutations option. how can modify current code include itertools.permutations , achieve same result?


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -