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
""" | |
Code to parse sklearn classification_report | |
""" | |
## | |
import sys | |
import collections | |
## | |
def parse_classification_report(clfreport): | |
""" | |
Parse a sklearn classification report into a dict keyed by class name |
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
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
def pretty_time_delta(seconds): | |
sign_string = '-' if seconds < 0 else '' | |
seconds = abs(int(seconds)) | |
days, seconds = divmod(seconds, 86400) | |
hours, seconds = divmod(seconds, 3600) | |
minutes, seconds = divmod(seconds, 60) | |
if days > 0: | |
return '%s%dd%dh%dm%ds' % (sign_string, days, hours, minutes, seconds) | |
elif hours > 0: | |
return '%s%dh%dm%ds' % (sign_string, hours, minutes, seconds) |
As configured in my dotfiles.
start new:
tmux
start new with session name: