Panduan Pengguna NumPy
Panduan pengantar komprehensif dan teknis tentang NumPy, mencakup instalasi, manipulasi array, indeksing, broadcasting, serta integrasi dengan C/C++.
Gambaran Umum Kursus
📚 Ringkasan Konten
Gambaran pengantar komprehensif dan panduan teknis tentang NumPy, mencakup instalasi, manipulasi array, indeksing, broadcasting, serta integrasi dengan C/C++.
Kelola dasar-dasar komputasi ilmiah dalam Python dengan panduan resmi NumPy.
Penulis: Komunitas NumPy
Ucapan Terima Kasih: Ditulis oleh komunitas NumPy
🎯 Tujuan Pembelajaran
- Menjelaskan apa itu NumPy dan mengidentifikasi perannya dalam ekosistem Python ilmiah.
- Menjelaskan mengapa NumPy jauh lebih cepat daripada loop Python standar menggunakan konsep vektorisasi.
- Menjalankan perintah instalasi untuk berbagai lingkungan termasuk Pip, Conda, dan Raspberry Pi.
- Mengidentifikasi dan menafsirkan atribut utama
ndarraysepertindim,shape, dandtype. - Menjalankan pembuatan dan manipulasi array menggunakan fungsi seperti
linspace,reshape,vstack, danhstack. - Menerapkan operasi elemen per elemen, fungsi universal (ufuncs), dan solver aljabar linear pada dataset numerik.
- Mengelola presisi data dan mencegah kesalahan overflow menggunakan tipe skalar NumPy serta alat informasi (
iinfo,finfo). - Menerapkan pengambilan data fleksibel dari disk menggunakan
genfromtxtdengan pemisah kustom, header, dan pemilihan kolom. - Menerapkan Aturan Broadcasting Umum untuk memprediksi dan mengendalikan interaksi antara array dengan bentuk berbeda.
- Mengelola referensi memori dan menghindari "jebakan" dalam subclass
ndarraykhusus menggunakan atribut.base.
Pelajaran 共 5 课时 · 预计 15.0h
Pelajaran
Lesson
This lesson introduces NumPy as the foundational bridge between high-level Python applications and low-level hardware, focusing on the ndarray as a universal interface for scientific computing. Students will learn how the ndarray’s contiguous memory layout and homogeneous data structure enable high-performance, vectorized operations across the data science ecosystem.
This lesson introduces the NumPy ndarray as a memory-efficient, homogeneous alternative to Python lists, focusing on proper initialization and the performance benefits of contiguous memory. Students will learn to interpret core array attributes—such as shape, size, and data type—to understand how metadata defines the spatial geometry and memory footprint of numerical data.
This lesson covers precision management in NumPy, focusing on how fixed-size data types handle integer overflow and floating-point saturation. It also introduces robust data ingestion techniques using np.genfromtxt to handle irregular file formats and sanitize messy datasets.
This lesson explores the complexities of subclassing `numpy.ndarray`, focusing on the "Initialization Triad" and the critical role of the `__array_finalize__` hook in maintaining metadata. Students will learn to navigate the risks of behavioral fragility and identify when to choose subclassing for interoperability versus using composition for safer architectural design.
AI018: Extending NumPy with the C-API (Lesson 5) explores how to overcome performance bottlenecks like the interpreter tax and memory bloat by implementing high-performance C extensions. Students will learn to manage memory safely, utilize kernel fusion, and perform cache-aligned pointer arithmetic to optimize complex computational tasks.