O'qituvch F. I. Sh
Download 325.02 Kb.
|
3- joriy Fully
- Bu sahifa navigatsiya:
- Chiqish
Chiqish:
Lug'at yordamida ro'yxatlardan pandalar ma'lumotlar ramkasini yaratish : Lug'at yordamida ro'yxatlardan pandalar ma'lumotlar ramkasini yaratishga turli yo'llar bilan erishish mumkin. Biz pandas.DataFrame yordamida lug'at yordamida ro'yxatlardan pandas dataframe yaratishimiz mumkin. Pandalarda ushbu usul yordamida biz ro'yxat lug'atini dataframega aylantirishimiz mumkin. Python 3# importing pandas as pd import pandas as pd # dictionary of lists dict = {'name':["aparna", "pankaj", "sudhir", "Geeku"], 'degree': ["MBA", "BCA", "M.Tech", "MBA"], 'score':[90, 40, 80, 98]} df = pd.DataFrame(dict) print(df) Chiqish: 2-amaliy ish Dastur kodi: import matplotlib.pyplot as plt from sklearn.cluster import KMeans x = [4, 5, 10, 4, 3, 11, 14 , 6, 10, 12] y = [21, 19, 24, 17, 16, 25, 24, 22, 21, 21] data = list(zip(x, y)) print(data) inertias = [] for i in range(1,11): kmeans = KMeans(n_clusters=i) kmeans.fit(data) inertias.append(kmeans.inertia_) plt.plot(range(1,11), inertias, marker='o') plt.title('Elbow usuli') plt.xlabel('Klasterlar soni') plt.ylabel('Inertsiya') plt.show() Dastur natijasi: Download 325.02 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling