def timeseries_split(df, test_fraction=0.2, dropna=None):
    """Split timeseries data with test in the future"""
    
    # If there are lots of nan's we can ignore them when splitting into portions
    if isinstance(dropna, list):
        index = df.dropna(subset=dropna).index
    elif dropna is True:
        index = df.dropna().index
    else:
        index = df.index
    
    i = int(len(index)*(1- test_fraction))
    dt = index.values[i]
    return df.loc[:dt], df.loc[dt:]