For at least 99% of my jupyter/ipython notebooks i use the following imports:
import pandas as pd
from pandas.io.json import json_normalize
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
from bson import json_util, ObjectId
import json
from datetime import datetime, timedelta
import pytz
pd.set_option('max_columns', 50)
mpl.style.use('ggplot')
%pylab inline
Has anyone discovered any sort of solution that would allow me to do this automatically or create some sort of macro?
I like to use the %load magic. Make a file with all the imports in, leave it in the home directory and start the notebook with
%load my_imports.py
This method lets you edit the imports before running them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With