python ipython jupyter - ghdrako/doc_snipets GitHub Wiki

JupySQL allows you to run SQL and plot large datasets in Jupyter via a %sql, %%sql, and %sqlplot magics. JupySQL is compatible with all major databases (e.g., PostgreSQL, MySQL, SQL Server), data warehouses (e.g., Snowflake, BigQuery, Redshift), and embedded engines (SQLite, and DuckDB).

%lsmagic  # list all avaliable magic command
%timeit

%timeit rand_nums = np.random.rand(1000)

# Set number of runs to2 (-r2)
# Set numbr of looops to 10 (-n10)
%timeit -r2 -n10 rand_nums = np.random.rand(1000)


# Multiple liine of code
%%timeit
nums=[]
for x in range(10):
  nyums.append(x)

# Saving output to variable (-o)
times = %timeit -o rand_nums = np.random.rand(1000)
times.timings  # show all times
times.best
times.worst