Calculate summary statistics of columns in dataframe

describe may give you everything you want otherwise you can perform aggregations using groupby and pass a list of agg functions: http://pandas.pydata.org/pandas-docs/stable/groupby.html#applying-multiple-functions-at-once In [43]: df.describe() Out[43]: shopper_num is_martian number_of_items count_pineapples count 14.0000 14 14.000000 14 mean 7.5000 0 3.357143 0 std 4.1833 0 6.452276 0 min 1.0000 False 0.000000 0 25% 4.2500 0 0.000000 0 … Read more

Benchmarking – How to count number of instructions sent to CPU to find consumed MIPS

perf stat –all-user ./my_program on Linux will use CPU performance counters to record how many user-space instructions it ran, and how many core clock cycles it took. And how much CPU time it used, and will calculate average instructions per core clock cycle for you, e.g. 3,496,129,612 instructions:u # 2.61 insn per cycle It calculates … Read more

What does the “System” category of records mean in Chrome Timeline profiling tool?

I asked me the same question two years ago. I didn’t know what the grey bars respectively the System category stand for. It was hard to find an official answer because the only thing the Chrome DevTools Docs said was “Activity that was not instrumented by DevTools”. But this statement was removed since there is … Read more

Recommendations for C Profilers? [closed]

Using gcc, I compile and link with -pg (as explained e.g. here), then continue by running the program (according to the principles also suggested at that URL) and using gprof. The tools will vary if you’re using different compilers &c, but the URL is still recommended, even then, for the parts that are about general … Read more

Accurate timing of functions in python

Use the timeit module from the Python standard library. Basic usage: from timeit import Timer # first argument is the code to be run, the second “setup” argument is only run once, # and it not included in the execution time. t = Timer(“””x.index(123)”””, setup=”””x = range(1000)”””) print t.timeit() # prints float, for example 5.8254 … Read more