IIS_2023_1/abanin_daniil_lab_4/lab4.py
BossMouseFire 1638a80b4a lab4
2023-10-24 01:14:04 +04:00

23 lines
710 B
Python

from scipy.cluster import hierarchy
import pandas as pd
from matplotlib import pyplot as plt
def start():
data = pd.read_csv('loan.csv')
x = data[['ApplicantIncome', 'LoanAmount', 'Credit_History', 'Self_Employed', 'Education']]
plt.figure(1, figsize=(16, 9))
plt.title('Дендрограмма кластеризации заявителей')
hierarchy.dendrogram(hierarchy.linkage(x, method='single'),
truncate_mode='lastp',
p=20,
orientation='top',
leaf_rotation=90,
leaf_font_size=8,
show_contracted=True)
plt.show()
start()