Created
January 27, 2019 17:48
-
-
Save adiamaan92/08eab60dbb32cefc4b2769ddf53fa43e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import sys | |
logger = logging.getLogger() | |
fhandler = logging.FileHandler(filename="mylog.log", mode="a") | |
formatter = logging.Formatter( | |
"%(asctime)s - %(name)s - %(levelname)s - %(message)s" | |
) | |
fhandler.setFormatter(formatter) | |
logger.addHandler(fhandler) | |
logger.setLevel(logging.DEBUG) | |
def csnap(df, fn=lambda x: x.shape, msg=None): | |
""" Custom Help function to print things in method chaining. | |
Returns back the df to further use in chaining. | |
""" | |
global logging | |
if msg: | |
print(msg) | |
logging.debug(f"{fn(df)}") | |
return df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment