IIS_2023_1/kondrashin_mikhail_lab_4/main.py

20 lines
505 B
Python
Raw Permalink Normal View History

2023-11-26 21:16:47 +04:00
from sklearn.cluster import KMeans
import pandas
from matplotlib import pyplot as plt
2023-11-26 22:54:55 +04:00
factors = ['T', 'RH', 'D1', 'TI1', 'P']
2023-11-26 21:16:47 +04:00
kmeans = KMeans(n_clusters=4)
data = pandas.read_csv('WindData.csv')
i = 0
for i in range(len(factors)):
corr = data[['V1', factors[i]]]
kmeans.fit(corr)
plt.xlabel('V1', fontsize=14)
plt.ylabel(factors[i], fontsize=14)
plt.scatter(corr.values[:, 0], corr.values[:, 1], c=kmeans.labels_)
plt.savefig('images/' + factors[i] + '-V1.png')
plt.show()