import pandas as pd # Import both the clustered pca data set and the corresponding data set that consists of zeros and ones plus the translation # of each observation dataframe = pd.read_csv('3785_2clusupdate.csv') trans_df = pd.read_csv("conversion+translation+index.csv") trans_df.to_csv('x.csv',index=False) # Extract the cluster column from the clustered dataset and append it to the other dataset cluster = dataframe['cluster'] trans_df['cluster'] = cluster # Sort the updated dataset by cluster sorting = trans_df.sort_values(by = 'cluster') # Save the sorted dataset as csv file sorting.to_csv('./GESORTEERD.csv', index=False)