If you’d like to install the iPython shell, you can easily time your code using %timeit. After installing it, instead of typing python
to launch the python interpreter, you would type ipython
.
Then you can type your code exactly as you would type it in the normal interpreter (as you did above).
Then you can type, for example:
%timeit DF.groupby(['id1']).agg({'v1':'sum'})
This will accomplish exactly the same thing as what you’ve done, but if you’re using python a lot I find that this will save you significant typing time :).
Ipython has a lot of other nice features (like %paste
, which I used to paste in your code and test this, or %run
to run a script you’ve saved in a file), tab completion, etc.
http://ipython.org/