Python Projects for Beginners a ten-Week Bootcamp Approach to Python Programming


Importance of Histogram Distribution



Download 2,61 Mb.
bet195/200
Sana20.06.2022
Hajmi2,61 Mb.
#681748
1   ...   192   193   194   195   196   197   198   199   200
Bog'liq
Python Projects for Beginners A Ten Week Bootcamp Approach to Python

Importance of Histogram Distribution


To see why histograms are so important with understanding central distribution, we’ll need to create some more fake data. We’ll then plot both datasets and see how they stack up:
CHapter 10 INtroduCtIoN to data aNalYsIs

# showing the importance of histogram's display central distribution florida = [ np.random.normal(loc=60, scale=15) for x in range(1000) ]
# assume numpy is imported
california = [ np.random.normal(loc=35, scale=5) for x in range(1000) ]
# chart 1
plt.hist(florida, bins=45, color="r", alpha=0.4) # alpha is
opacity, making it see through plt.show( ) # chart 2
plt.hist(california, bins=45, color="b", alpha=0.4) # alpha is opacity,
making it see through
plt.show( ) # chart 3
plt.hist(florida, bins=45, color="r", alpha=0.4) # alpha is
opacity, making it see through
plt.hist(california, bins=45, color="b", alpha=0.4) # alpha is opacity,
making it see through
plt.show( )

Go ahead and run the cell. We’re able to output three different histograms within this cell because of the three show methods being called. When you look at the first two histograms, they look identical. It’s tough to see, without looking further into the charts, that the data is completely different. Therefore, to view the data properly, we output the third histogram with both datasets overlapping as seen in Figure 10-7.
We’re now able to clearly see the difference in central distribution of each dataset. This is important when it comes to analyzing data. We set alpha to 0.4 because it allows us to set the opacity. The higher the number, the more solid the data becomes.
CHapter 10 INtroduCtIoN to data aNalYsIs

Figure 10-7. Histogram distribution plotting importance
Note When rendering several charts, matplotlib understands how to separate each plot by resetting the chart to empty after the show method is run, until then all information being plotted will be included in one chart.

Download 2,61 Mb.

Do'stlaringiz bilan baham:
1   ...   192   193   194   195   196   197   198   199   200




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish