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



Download 2,61 Mb.
bet180/200
Sana20.06.2022
Hajmi2,61 Mb.
#681748
1   ...   176   177   178   179   180   181   182   183   ...   200
Bog'liq
Python Projects for Beginners A Ten Week Bootcamp Approach to Python

ages

names

0 25

Jess

1 35

Jordan

2 22

sandy

3 29

ted

4 33

Barney

5 20

tyler

6 18

rebecca

Accessing Data


There are a few different ways that we can access the data within a DataFrame. You have the option to choose by the column or by the record. Let’s look at how to do both.

Indexing by Column


Accessing data by a column is the same as accessing data from a dictionary with the key. Within the first set of brackets, you put the column name that you would like to access. If you’d like to access a specific record within that column, you use a second set of brackets with the index:

1| # directly selecting a column in Pandas
2| print( df["ages"] )
3| print( df["ages"][3] ) # select the value of "ages" in the fourth row (0-index based)
5| # print( df[4] ) doesn't work, 4 is not a column name

Go ahead and run the cell. On line 2 we output the entire ages column of data. The second statement allows us to access the value at a specific cell. Be careful though, putting the index number in the first set of brackets will create an error, as the first set is only meant for column names and “4” is not a column.

Download 2,61 Mb.

Do'stlaringiz bilan baham:
1   ...   176   177   178   179   180   181   182   183   ...   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