In [1]: %precision 2
Out[1]: '%.2f'
In [2]: import math
In [3]: math.sqrt(2)
Out[3]: 1.41
In [1]: %time sum(range(10000))
CPU times: user 91 µs, sys: 6 µs, total: 97 µs
Wall time: 98.2 µs
Out[1]: 49995000
In [1]: %timeit sum(range(10000))
114 µs ± 8.23 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)
In [1]: %load example.py
In [2]: # %load -r 1:3 example.py
...: import numpy as np
...: import pandas as pd
In [1]: %save sample.py 1
The following commands were written to file `sample.py`:
get_ipython().run_line_magic('load', 'example.py')
Ref.: https://ipython.readthedocs.io/en/stable/interactive/magics.html
Oldest comments (0)