-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
77 lines (67 loc) · 1.93 KB
/
config.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# configs and utilities
# pylab inline + other magic
from IPython import get_ipython
ipython = get_ipython()
ipython.magic('pylab inline')
ipython.magic('config InlineBackend.figure_format="retina"')
ipython.magic('load_ext autoreload')
ipython.magic('autoreload 2')
import pandas as pd
pd.set_option('display.precision', 4)
pd.options.display.float_format = '{:.4f}'.format
pd.plotting.register_matplotlib_converters()
from pandas import DataFrame, Series
D, S = DataFrame, Series
import numpy as np
import scipy.stats as stats
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(
style='ticks',
font_scale=1.25,
color_codes=True,
rc={
'figure.figsize': (9, 6),
'grid.color': '#dddddd',
'axes.titlepad': 18,
'legend.frameon': False,
'axes.edgecolor': '#dddddd',
'axes.grid': True,
'xtick.minor.visible': True,
'ytick.minor.visible': True
}
# rc={
# 'figure.figsize': (10, 7),
# 'axes.spines.top': False,
# 'axes.spines.right': False
# }
)
# cells can have multiple outputs
from IPython.core.interactiveshell import InteractiveShell
from IPython.display import display
InteractiveShell.ast_node_interactivity = "all"
# setup hvplot and plotly
try:
import hvplot.pandas
import holoviews as hv
hvkw = dict(height=500, width=800, grid=True, legend='top')
except ImportError:
pass
try:
import plotly.express as px
px.defaults.template = "gridon"
px.defaults.width = 700
px.defaults.height = 500
pd.options.plotting.backend = 'plotly'
except ImportError:
pass
def df_info(df):
display(df.info(verbose=True))
display(df.describe(include='all'))
display(df.sample(10))
# print setup info
import os
print('\nworking directory : ' + os.getcwd() + '\n')
print(ipython.banner)
import subprocess
print(subprocess.run(['conda', 'info'], capture_output=True, shell=True).stdout.decode("utf-8"))