start_time = time.clock() result = 0 for row in df.itertuples(index=False): result += max(row[df.columns.get_loc('B')], row[df.columns.get_loc('C')]) total_elapsed_time = round(time.clock() - start_time, 2) print("4. Polyvalent Itertuples working even with special characters in the column name done in {} seconds, result = {}".format(total_elapsed_time, result))
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter