-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01-common.ipy
50 lines (39 loc) · 1.35 KB
/
01-common.ipy
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(format='%(asctime)s [%(process)d] [%(levelname)s] %(message)s',
datefmt='%Y-%m-%d %H:%M:%S', level=logging.INFO)
requests_logger = logging.getLogger('requests')
requests_logger.setLevel('WARNING')
try:
import regex as re
except ImportError:
logging.info('Regex module not found. Will use regular `re`.')
import re
import numpy as np
import pandas as pd
pd.set_option('display.width', 2000)
pd.set_option('max_colwidth', 800)
pd.set_option('max_rows', 200)
if 'terminal' in str(get_ipython()):
import matplotlib
matplotlib.use('Agg')
else:
# Configurations for notebook only
%matplotlib inline
from matplotlib import pyplot as plt
# Source: https://www.lucypark.kr/slides/2015-pyconkr/#51
from matplotlib import font_manager, rc
from sys import platform as _platform
if _platform == "linux" or _platform == "linux2": # linux
font_fname = '/usr/share/fonts/nanumfont/NanumGothic.ttf'
elif _platform == "darwin": # MAC OS X
font_fname = '/Library/Fonts/AppleGothic.ttf'
elif _platform == "win32": # Windows
font_fname = 'c:/windows/fonts/gulim.ttc'
else:
raise Exception('Unknown OS')
font_name = font_manager.FontProperties(fname=font_fname).get_name()
rc('font', family=font_name)
plt.style.use('ggplot')
import seaborn as sns