'Import headers and modules in Jupyter Notebook

I always start my notebook with the following lines of code:

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(style='ticks', color_codes=True)

I wonder if I can save such lines in a separate, say, starter.txt or starter.py file once. Start notebook by loading these libraries and setting by simply loading it as module

import starter
pd.read_excel("data.xlsx")

I tried above. The code does not complain on import statement but does not recogine pd as pandas.

What is a good way to do these things. Similary I want to write modules with functions and import all the function.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source