I hereby claim:
- I am ys-l on github.
- I am liauys (https://keybase.io/liauys) on keybase.
- I have a public key ASAzTx57Edln8xZW5qIk-WBCyrkKL_c87j5901kSgRIw1wo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| def mkdir_p(directory): | |
| """Create a directory if necessary""" | |
| # Thread safe | |
| import os | |
| try: | |
| os.makedirs(directory) | |
| except OSError: | |
| pass | |
| import time | |
| class Timer(object): | |
| """ A quick tic-toc timer | |
| Credit: http://stackoverflow.com/questions/5849800/tic-toc-functions-analog-in-python | |
| """ | |
| def __init__(self, name=None, verbose=True): |
| def in_ipynb(): | |
| try: | |
| cfg = get_ipython().config | |
| if cfg['IPKernelApp']['parent_appname'] == 'ipython-notebook': | |
| return True | |
| else: | |
| return False | |
| except NameError: | |
| return False |
| from traceback import print_exception | |
| class Tee(object): | |
| """ Multiplex stdout to a file | |
| Possibly useful for inspecting the output of a long running python process started via IPython. | |
| Adapted from answers found in SO questions [1] and [2]. |
| import pandas as pd | |
| from functools import wraps | |
| @wraps(pd.read_csv) | |
| def to_dataframe(s, sep='[\s]+', **kwargs): | |
| """ | |
| Convert a human readable DataFrame representation to an actual DataFrame | |
| s : string |