Correlation analysis scatter plot

PD PANDAS AS Import
DF2 = pd.read_excel ( './ Data / data2.xlsx', index_col = 'Product Code')
df2.head ()
X = DF2 [ 'supplier purchase price']
Y = DF2 [ 'sales price ']
from pylab Import MPL
mpl.rcParams [' serif-font.sans'] = [ 'FangSong']
# scattergram
import matplotlib.pyplot as plt

Fig, AX = plt.subplots ()
ax.scatter (X, Y, Color = 'Green')
ax.set (= the xlabel 'supplier purchase price', ylabel = 'sales price', title = 'sales analysis' )
plt.show ()

# Scatter matrix
from pandas.plotting Import scatter_matrix
scatter_matrix (DF2, figsize = (10,10), marker = 'O', Alpha = 0.5)
plt.show ()

# Correlation coefficient
df2.corr ()
DF2 [ 'sales price'] .corr (df2 [ 'supplier purchase price'])

Guess you like

Origin www.cnblogs.com/tiankong-blue/p/11620612.html