Q:

How to show the correlation between counts and rate?

my dataset
Name rate  counts
A    10.3  3
B    15.4  9
C    21.9  11
D    9.11  4
E    2.21  5
F    7.7   21
G    18.9  20
H    55.1  41

The dataset shows the counts and rate of people with different names.
I want to know the correlation of rate with the counts.
For example, if the counts is high, the rate is high or low.
Which method is right for showing the connection between the two?..

A:

Check this code:
# import requires packages
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

# read the data file
df = pd.read_csv('data.csv')

# calculate correlation matrix
corr = df.corr()

# prepare the plot
sns.heatmap(corr, annot = True, vmin = 0, vmax = 1)

# show the plot
plt.show()

which gives me the following correlation matrix:

as you can see the correlation between rate and count is quite high: 0.85. However consider that I only used the data you reported above, just 8 rows, maybe you should use a higher sample for more reliable results.

