import pandas as pd
# Create the data
data = {
"x": [-6, 2, 0.2, 7, -4],
"y": [6.4, 4.7, 8, 2, 3.4]
}
# Load data into DataFrame
df = pd.DataFrame(data)
# Calculate Pearson's correlation coefficient
correlation = df['x'].corr(df['y'], method='pearson')
# Round to one decimal place
rounded_correlation = round(correlation, 1)
# Print the result
print(rounded_correlation)
# answer is -0.5