Shape, Size ve dtype
Bir dizinin yapısını okumayı öğrenin.
Shape, Size ve dtype, 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.
Read the Array's Anatomy
Every array carries metadata about itself. Three labels tell you almost everything: its shape, its size, and its dtype. Let's read each one. 🔍
Shape: Rows and Columns
The shape is a tuple of dimension lengths. A 3-by-4 grid reports (3, 4): three rows down, four columns across.
a = np.zeros((3, 4))
a.shape # (3, 4)Shape Tells You the Layout
Shape is your first sanity check. If a model expects (100, 5) and you hand it (5, 100), the shape mismatch is where bugs hide.
ndim: How Many Dimensions
The ndim attribute counts dimensions. A flat row is 1, a table is 2, a stack of tables is 3. It is just the length of the shape.
a.ndim # 2Size: Total Element Count
The size is the total number of elements, the product of every shape value. A (3, 4) array has a size of 12.
a.size # 12dtype: The One Shared Type
The dtype names the single type all elements share, like int64 or float64. It controls both precision and memory use.
np.array([1, 2, 3]).dtype # int64Choose Your dtype on Purpose
You can set the type yourself with the dtype argument. Use a smaller type like int32 to save memory on huge arrays.
np.array([1, 2, 3], dtype='int32')dtype Affects Precision
float32 holds fewer decimals than float64. Tiny rounding gaps add up, so pick the type your numbers actually need.
Convert With astype
Already have an array? astype returns a copy in a new type, handy for turning floats into clean integers.
f = np.array([1.0, 2.0])
f.astype('int64')itemsize: Bytes Per Element
The itemsize tells you bytes per element. Multiply it by size to estimate the array's total memory footprint.
a.itemsize # 8 for float64Inspect Before You Compute
Checking shape and dtype first saves hours. They reveal mismatched data and wrong types before a calculation quietly goes wrong. ✅
Quick Check
Let's test your read of an array's shape.
Recap
You can now read an array at a glance: shape for layout, ndim and size for counts, and dtype for the shared type. These four checks catch most bugs early. 🎉
Sıkça Sorulan Sorular
“Shape, Size ve dtype” dersi ücretsiz mi?
Evet — “Shape, Size ve dtype” 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.
“Shape, Size ve dtype” dersinde ne öğreneceğim?
Bir dizinin yapısını okumayı öğrenin. 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.
“Shape, Size ve dtype” 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
- Python Listesinden ndarray’e
- Shape, Size ve dtype
- Döngüsüz Vektörleştirilmiş Matematik
- Dizileri Dizinleme ve Dilimleme