Best way to get a specific column as y in pandas DataFrame

I want to extract one specific column as y from a pandas DataFrame. I found two ways to do this so far: # The First way y_df = df[specific_column] y_array = np.array(y_df) X_df = df.drop(columns=[specific_column]) X_array = np.array(X_df) # The second way features = [‘some columns in my dataset’] y_df = np.array(df.loc[:, [specific_column]].values) X_df =… Read More Best way to get a specific column as y in pandas DataFrame