This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ülkeler mutluluk siralamasi kriterleri ve max enfekte olan sayi arasindaki korelasyon icin iki veri setimizde artik hazir | |
#öncelikle join ile iki verinin tek cerceve icine alinmasi: | |
data = corona_data.join(happiness_report_csv,how="inner") | |
data.head() | |
#daha sonra korelasyon fonksiyonunu kullanacagiz: | |
data.corr() | |
#ve datanin görsellestirilme islemi baslar: | |
data.head() | |
#iki verinin seaborn ile korelasyon incelemesi: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#yukarda daha önceden tanimlanmis bir 'max_infection_rates' varsa 'max_infection_rate' sütununu eklemek icin: | |
corona_dataset_aggregated["max_infection_rate"] = max_infection_rates | |
#sadece bu sütunu diger sütunlar olmaksizin göstermesi icin: | |
corona_data = pd.DataFrame(corona_dataset_aggregated["max_infection_rate"]) | |
corona_data.head() | |
#kullanilmayacak sütunlardan kurtulma: | |
#önce hangi sütunlari istemiyoruz listeleyelim: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
countries = list(corona_dataset_aggregated.index) | |
max_infection_rates = [] #bu bos bir liste | |
for c in countries : #simdi bir döngü olusturuyoruz,her ülke icin liste ismini countries diye belirledigimiz icin karisiklik olmamasi icin her country ifadesini kisace her c diyelim: | |
max_infection_rates.append(corona_dataset_aggregated.loc[c].diff().max()) | |
max_infection_rates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#hangi periyotlarin öne ciktigini vurgulamak gözlemek icin türev grafik faydalidir. | |
#göze carpan, trend olan böylece daha net anlasilir | |
corona_dataset_aggregated.loc["China"].diff().plot() | |
#maksimum yeni enfekte hasta sayisini ögrenmek icin (Cin - Italya - Ispanya): | |
corona_dataset_aggregated.loc["China"].diff().max() | |
corona_dataset_aggregated.loc["Italy"].diff().max() | |
corona_dataset_aggregated.loc["Spain"].diff().max() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
corona_dataset_aggregated.loc["China"] | |
#ayni veriyi plot ile görsellestirmek istersek: | |
corona_dataset_aggregated.loc["China"].plot() | |
#grafikte kime ait oldugu da gösterilsin istersek: | |
plt.legend() | |
#sadece veri setimizdeki ilk 3 günün verisini Cin icin göstermek istersek: | |
corona_dataset_aggregated.loc["China"][:3].plot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df_aggregated = x_dataset_csv.groupby("Sütun Ismi").sum() | |
#böylece sütun altindaki veriler birlestirilmis oluyor (aggregated data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df.drop(["X", "Y"],axis=1,inplace=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plt.figure(figsize=(15,10)) | |
sns.barplot(x=city_names, y=city_values, palette=sns.color_palette('BuGn', n_colors=10)) | |
plt.xticks(rotation= 45) | |
plt.xlabel('Citys') | |
plt.ylabel('Size'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
city_names = first_ten_citys.index | |
city_values = first_ten_citys.values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
first_ten_citys = sbucks_de.City.value_counts()[:10] | |
first_ten_citys |
NewerOlder