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)
| import numpy as np | |
| from scipy import stats | |
| from itertools import combinations | |
| from statsmodels.stats.multitest import multipletests | |
| from statsmodels.stats.libqsturng import psturng | |
| import warnings | |
| def kw_nemenyi(groups, to_compare=None, alpha=0.05, method='tukey'): | |
| """ |
| import numpy as np | |
| from scipy import stats | |
| from itertools import combinations | |
| from statsmodels.stats.multitest import multipletests | |
| from statsmodels.stats.libqsturng import psturng | |
| import warnings | |
| def kw_dunn(groups, to_compare=None, alpha=0.05, method='bonf'): | |
| """ |
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)
| #!/bin/bash | |
| # Author: Maxwel Leite | |
| # Website: http://needforbits.wordpress.com/ | |
| # Description: Script to install Microsoft Vista TrueType Fonts (TTF) aka Microsoft’s ClearType fonts on Ubuntu distros | |
| # Microsoft added a group of new "ClearType Fonts" to Windows with Windows Vista and Office 2007. | |
| # These fonts are named Constantia, Corbel, Calibri, Cambria (and Cambria Math), Candara, and Consolas. | |
| # Calibri became the default font on Microsoft Word 2007, and it’s still the default font on Word 2016 today. | |
| # Dependencies: wget, fontforge and cabextract | |
| # Note: Microsoft no longer provides the PowerPoint Viewer 2007 (v12.0.4518.1014) or any version anymore for download | |
| # Tested: Ubuntu Saucy/Trusty/Xenial/Bionic |
| """ | |
| Implementation of the beta-geometric/NBD (BG/NBD) model from '"Counting Your Customers" the Easy Way: An Alternative to | |
| the Pareto/NBD Model' (Fader, Hardie and Lee 2005) http://brucehardie.com/papers/018/fader_et_al_mksc_05.pdf and | |
| accompanying technical note http://www.brucehardie.com/notes/004/ | |
| Apache 2 License | |
| """ | |
| from math import log, exp | |
| import numpy as np |
| """ | |
| Implementation of the shifted beta geometric (sBG) model from "How to Project Customer Retention" (Fader and Hardie 2006) | |
| http://www.brucehardie.com/papers/021/sbg_2006-05-30.pdf | |
| Apache 2 License | |
| """ | |
| from math import log |
| #!/bin/bash | |
| STARTPAGE=2 | |
| ENDPAGE=75 | |
| SOURCE=book.pdf | |
| OUTPUT=book.txt | |
| RESOLUTION=600 | |
| LAYOUT="1" | |
| [[ -e out.txt ]] && rm out.txt | |
| for i in `seq $STARTPAGE $ENDPAGE`; do |
| from decimal import Decimal | |
| try: | |
| import simplejson as json | |
| except ImportError: | |
| import json | |
| from django.utils.functional import Promise | |
| class CustomJSONEncoder(json.JSONEncoder): |
| import os | |
| # Automatically set the __all__ variable with all | |
| # the available plugins. | |
| plugin_dir = "plugins" | |
| __all__ = [] | |
| for filename in os.listdir(plugin_dir): | |
| filename = plugin_dir + "/" + filename |