import pandas as pd df = pd.read_csv('https://services.healthtech.dtu.dk/services/DeepLoc-2.0/data/Swissprot_Train_Validation_dataset.csv').drop(['Unnamed: 0', 'Partition'], axis=1) df = df.melt(['Kingdom', 'ACC', 'Sequence','Membrane'], var_name='Location').query('value == 1.0').drop(labels='value', axis=1).astype({'Membrane': 'int8'}) train = df.sample(frac=0.8) df = df.drop(train.index) val = df.sample(frac=0.5) test = df.drop(val.index) train = train.reset_index(drop=True) val = val.reset_index(drop=True) test = test.reset_index(drop=True) train.to_parquet('deeploc-train.parquet', index=False) val.to_parquet('deploc-val.parquet', index=False) test.to_parquet('deeploc-test.parquet', index=False)