You can use the corr() method to find the correlation between two specific columns in a DataFrame.
import pandas as pd
# Create a sample DataFrame
data = {'A': [1, 2, 3, 4, 5],
'B': [5, 4, 3, 2, 1]}
df = pd.DataFrame(data)
# Calculate the correlation between columns A and B
correlation_AB = df['A'].corr(df['B'])
print(f"Correlation between A and B: {correlation_AB}")