Remove pandas rows with duplicate indices

I would suggest using the duplicated method on the Pandas Index itself: df3 = df3[~df3.index.duplicated(keep=’first’)] While all the other methods work, .drop_duplicates is by far the least performant for the provided example. Furthermore, while the groupby method is only slightly less performant, I find the duplicated method to be more readable. Using the sample data … Read more

Fastest way to duplicate an array in JavaScript – slice vs. ‘for’ loop

There are at least 6 (!) ways to clone an array: loop slice Array.from() concat spread operator (FASTEST) map A.map(function(e){return e;}); There has been a huuuge BENCHMARKS thread, providing following information: for blink browsers slice() is the fastest method, concat() is a bit slower, and while loop is 2.4x slower. for other browsers while loop … Read more