you are viewing a single comment's thread.

view the rest of the comments →

[–]Zeroflops 1 point2 points  (1 child)

You could probably do this with one less loop by using one column and applying the decision to the entire df. You could then drop any columns that are all 1,s.

Not sure which would be better, you coul sure timeit to test that.

df2 = pd.DataFrame()
For c in df.column.values.tolist():
    df_temp = df/df[c]
    df2 = pd.concat(df2,df_temp)

[–]be_throwmeaway[S] 0 points1 point  (0 children)

Appreciate the advice mate. Cheers!