0Pricing
Data Science Academy · Ders

Etikete Göre ve Konuma Göre Erişim

loc veya iloc seçimini güvenle yapın.

Etikete Göre ve Konuma Göre Erişim, CoddyKit'te ücretsiz bir Data Science Academy dersidir. Bu, 4 dersinin 2. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Data Science Academy öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Data Science Academy kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Two Ways to Reach In

A Series has both labels and positions, so there are two ways to grab a value: by its label or by its position number. Knowing which to use keeps your code clear. 🎯

Our Sample Series

Here is a small Series with string labels. We will use it to compare both access styles throughout this lesson.

import pandas as pd
s = pd.Series([90, 75, 88], index=['Ada', 'Bo', 'Cy'])

loc Uses Labels

The .loc accessor looks values up by their index label. You ask for a name and pandas returns that named value.

print(s.loc['Bo'])

iloc Uses Positions

The .iloc accessor works by integer position instead, counting from zero like a normal list. Position 1 is the second value.

print(s.iloc[1])

Same Value, Two Roads

With our Series, s.loc['Bo'] and s.iloc[1] return the same number. They reach it differently: one by name, one by spot.

print(s.loc['Bo'] == s.iloc[1])

Slicing With iloc

Position slices behave like list slices: the end is excluded. So iloc[0:2] returns the first two values only.

print(s.iloc[0:2])

Slicing With loc

Label slices are different: with .loc, the end label is included. Asking from 'Ada' to 'Bo' returns both endpoints.

print(s.loc['Ada':'Bo'])

The Inclusive Surprise

That inclusive end is the most common mix-up. Remember: iloc drops the last position, while loc keeps the last label. 🧠

Grab Several at Once

Pass a list of labels to .loc to pull many values together. The result is a smaller Series in the order you asked.

print(s.loc[['Ada', 'Cy']])

When Labels Are Numbers

If your index is integers, plain s[2] gets ambiguous. Using explicit .loc or .iloc removes all doubt about what you meant.

Pick With Confidence

Reach for .loc when you know the name, and .iloc when you know the spot. Being explicit makes your selections impossible to misread.

Quick Check

Test your grip on the two accessors.

Recap

You now choose .loc for labels and .iloc for positions, and you remember that loc slices include the end while iloc slices do not. Solid! 🎉

Sıkça Sorulan Sorular

“Etikete Göre ve Konuma Göre Erişim” dersi ücretsiz mi?

Evet — “Etikete Göre ve Konuma Göre Erişim” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Data Science Academy kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Data Science Academy kursu toplamda 4 dersten oluşur.

“Etikete Göre ve Konuma Göre Erişim” dersinde ne öğreneceğim?

loc veya iloc seçimini güvenle yapın. Data Science Academy ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Data Science Academy öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Data Science Academy, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 2. dersidir.

“Etikete Göre ve Konuma Göre Erişim” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Data Science Academy dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Data Science Academy dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Adı ve Dizini Olan Bir Sütun
  2. Etikete Göre ve Konuma Göre Erişim
  3. Series Matematiği ve Hizalama
  4. Değerleri Sayma ve Belirleme
← Data Science Academy Sayfasına Dön