def discretise(x, n = 4, smooth = True, codes = False):
    if codes == False: codes = None
    else: codes = False
    if smooth == True:
        try: return pd.qcut(x, q = n, duplicates = 'drop', labels = codes)
        except: return pd.cut(x, q = n, labels = codes)
    else:
        return pd.cut(x, bins = n, labels = codes)