You can sort the correlation matrix and extract the columns with the highest correlation to a specific column.
import pandas as pd
# Create a sample DataFrame
data = {'A': [1, 2, 3, 4, 5],
'B': [5, 4, 3, 2, 1],
'C': [2, 3, 1, 4, 5]}
df = pd.DataFrame(data)
# Calculate the correlation matrix
correlation_matrix = df.corr()
# Find the columns with the highest correlation to column A
most_correlated_columns = correlation_matrix['A'].sort_values(ascending=False).index[1:]
print(f"Columns most correlated with A: {most_correlated_columns}")