import pandas as pd

def concat_datasets(Xs, ys, feature_names, cat_name='category'):
    dfs = []
    for i, (X,y) in enumerate(zip(Xs,ys)):
        df = pd.DataFrame(X, columns=feature_names)
        df['y'] = y
        df[cat_name] = i + 1    # Note that because Julia is 1-indexed, we need to add 1 to the category index. Only relevant for PySR
        dfs.append(df)
    df = pd.concat(dfs)
    return df
