Here is the explanation of the preceding code:
- scores_data = pd.read_csv('test_scores_results.txt',header=None) reads the data from the Excel file, which does not have a header. It has test1 and test2 scores and the status 0 for rejected and 1 for accepted.
- scores_data = np.array(scores_data) converts scores_data to a NumPy array.
- df = pd.DataFrame(data=scores_data, columns=columns) creates a pandas DataFrame, df, using the scores_data array and the column names list.
- df_accepted = df[(df['Accepted'] == 1.0)] creates the df_accepted DataFrame for accepted data with test1 and test2 scores.
- df_rejected = df[(df['Accepted'] == 0.0)] creates the df_rejected DataFrame for rejected data with test1 and test2 scores.
- accepted_score1 ...