i'm trying understand fastest way loop through in pandas. read in many places itertuples better regularly looping through data, , best apply. if case why regular loops come out fastest? maybe i'm not understanding results, 10 loops, best of 3
mean?
%%timeit xlist= [] row in tomood.itertuples(): xlist.append(row[1] + 1) 1 loop, best of 3: 266 ms per loop in [54]: %%timeit zlist = [] row in tomood['user_id']: zlist.append(row + 1) 10 loops, best of 3: 83 ms per loop in [56]: %%timeit tlist = tomood['user_id'].apply(lambda x: x+1) 10 loops, best of 3: 138 ms per loop
Comments
Post a Comment