-
Notifications
You must be signed in to change notification settings - Fork 0
/
jupyter_utils.py
28 lines (22 loc) · 941 Bytes
/
jupyter_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def maximize_notebook():
try:
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
except Exception as e:
print(f'Error while maximizing the notebook cells: {str(e)}')
def apply_options(pd, max_rows = 500, max_columns = 500, d_width = 1000):
if pd is None:
print('Please import pandas before calling this function.')
return
pd.set_option('display.expand_frame_repr', True)
pd.set_option('display.max_rows', max_rows)
pd.set_option('display.max_columns', max_columns)
pd.set_option('display.width', d_width)
pd.set_option('display.max_colwidth', None)
pd.options.mode.chained_assignment = None
pd.set_option('display.float_format', lambda x: '%.6f' % x)
pd.set_option('use_inf_as_na', True)
def reload(module):
import importlib
importlib.reload(module)
maximize_notebook()