เรียน Python for Data Science ฉบับตั้งไข่ เรียนง่ายเป็นเร็ว

Why take this course?
สำหรับหัวข้อที่ 3 "เรียนเขียนโปรแกรมใช้งาน Python Functions สำหรับงาน Data Science":
-
เรียกใช้ฟังก์ชันพื้นฐาน: ใน Python, คุณสามารถเรียกใช้ฟังก์ชันพื้นฐานได้ทั่วไป โดยใช้
function_name()
หรือmodule.function_name(args)
ตัวอย่างเช่นprint()
,abs()
,len()
,sum()
และsorted()
. -
สร้าง Multiple Arguments: ฟังก์ชันสามารถ接受มากว่าหนึ่งอยู่ด้วยกาบใช้คำตัว
*args
สำหรับเป็นไปได้มากของ args หรือ**kwargs
สำหรับทั้งหมดของ keyword arguments. -
สร้าง String Methods: Python มีหลายฟังก์ชันที่ใช้เพื่อปรับแต่ง string ไว้ ตัวอย่างเช่น
str.capitalize()
,str.upper()
,str.lower()
,str.strip()
,str.split()
,str.join()
และstr.replace()
. -
สร้าง List Methods 1: สำหรับ list, คุณสามารถใช้ method เช่น
list.append(element)
,list.extend(iterable)
,list.insert(index, element)
,list.pop()
,list.remove(value)
,list.clear()
,list.count(element)
,list.index(element)
และlist.index(element, start, end)
. -
สร้าง List Methods 2: ต่อไปนี้คือ method เพิ่มเติมที่จัดการ list:
list.reverse()
,list.sort(key=None, reverse=False)
,list.copy()
และlist.fromkeys(iterable, value)
. -
สร้าง List Comprehensions: การสร้าง list โดยใช้ comprehension ทำให่การสร้าง list นั้นมีประโยคและอ่านได้ง่ายขึ้น.
-
สร้าง Custom Functions: คุณสามารถสร้างฟังก์ชันตรงกับความต้องการของคุณได้โดยใช้
def my_function(arg1, arg2, ...):
และจัดส่งการทำงานที่ต้องการภายนอกจากฟังก์ชัน. -
สร้าง lambda Functions:
lambda arg1, arg2, ...: expression
เป็นฟังก์ชันบูรณากรมที่มีความสะดวกในการใช้งานจำนวนเล็กของ argument และสร้างผลลัพธ์ที่เป็นตัวเฉพาะ. -
สร้าง Function with Default Arguments: คุณสามารถกำหนด default argument ในฟังก์ชันได้ หากไม่ใส่ argument ที่กำหนด default เมื่อเรียกใช้ฟังก์ชันมัจจุบค่าจะใช้ที่กำหนด default แล้ว.
-
สร้าง Function Decorators: ฟังก์ชัน decorator ใช้เพื่อแต่งชุมชนและเปลี่ยนแปลผลจากฟังก์ชันอื่นๆ โดยใช้คำสั่ง
@decorator_name
ข้างต้นของฟังก์ชัน. -
สร้าง Function with Variable Number of Arguments: ใช้
*args
และ**kwargs
เพื่อทำให้ฟังก์ชันสามารถแก้ครีเว็ตของ argument ได้. -
สร้าง Function that Returns Functions: คุณสามารถสร้างฟังก์ชันที่จะทำให้ฟังก์ชันอื่นๆ มาใช้ได้โดยการเรียกใช้ผลลัพธ์ของฟังก์ชันนั้น.
-
สร้าง Closures: Closure คือฟังก์ชันที่มีอัตรา (closure) หลายอันที่อยู่ภายในแหล่บของฟังก์ชันอื่นๆ, และสามารถเข้าถึงและใช้ตัวแปรที่พิจารณาไว้ในอัตราแหล่บนั้นได้.
-
สร้าง Iterators and Generator Functions: การใช้ generator expression
(expression for item in iterable if condition)
และ generator functiondef generator_function(): pass
ช่วยในการจัดการข้อมูลที่ไม่ต้องจำนวนอยู่ในหนึ่งที่เพีyจริง. -
สร้าง With Statement Context Managers: คำสั่ง
with
ใช้เพื่อรับและปฏิบัติกับ resource โดยทีมเองให้สร้าง context manager class ที่จัดการการสร้าง, ใช้งาน, และปรุง resource. -
สร้าง Function for Asynchronous Tasks: การใช้ async function definition
async def my_asynchronous_function(...):
และ await expression ทำให่ Python สามารถจัดการ tasks ที่ทำงานอย่างเป็นรูปขึ้นได้. -
สร้าง and Using Collections: ใช้ collections module สำหรับการสร้าง data structures พิมพ์เฉพาะที่ เช่น deque, Counter, defaultdict, OrderedDict 등.
-
Using Dataclasses for Data Modeling: การใช้ dataclasses (from typing module) ทำให้การสร้างและจัดส่ง class สำหรับ data structure นั้นง่ายและประสาน.
-
Using Typing Module: การใช้ typing module ทำให้โค้ดมี type hints ที่ชัดเจนสูงสุดสามารถช่วยให้แลกประมาณ (IDE) สามารถตรวจสอบ type ของคำต่างได้.
-
Using Enum Types: การสร้าง enum class ใช้เพื่อจัดการชุมชนที่มีค่าแบ่ล่ะ (member) ที่ชัดเจนสูงสุด.
-
Using Operator Overloading: การสร้าง class ที่ใช้ operator overloading อิสระสำหรับ operator ต่างๆ เช่น
__add__
,__mul__
,__str__
,__repr__
พยายามให้ผลการทำงานของ object พิมพ์เฉพาะกับ operator ที่ใช้งาน. -
Using Slots for Memory Efficiency: การใช้ slots ใน class ช่วยจำนวนของ object นั้นให้เพีyสงบตามที่ต้องการ, และปฏิบัติต่อการเข้าถึง attribute ของ object.
-
Using Memoryview for Efficient Buffer Access: memoryview ช่วยให้ Python สามารถจัดการและเข้าถึง data อ้างอิงจาก array อื่นๆ (bytes, bytearray, memoryview ของ numpy array) ได้โดยตรง.
-
Using C Extension with cffi: cffi ใช้เพื่อติดตั้ง Python กับ code จาก C โดยทีมที่ไม่ต้องใช้คอนฟรา์มขั้นสูง (like Cython).
-
Using Cython for Statically Typed C Extensions: Cython ช่วยให้เขียน code ที่เป็น Python และคอนฟรา์มจาก C สำหรับการเพิ่ม performance โดยใช้ typing ที่เป็นสถานะ (static typing).
-
Using Pybind11 for C++ Extensions: pybind11 เป็น library ที่ช่วยสร้าง bridged code between Python and C++ with first-class support for templates, overloading, and other advanced features of C++.
-
Using Swig for Language Binding: Software Interface Generator (Swig) เป็น tool ที่ช่วยสร้าง interfaces between Python and other languages like C, C++, Java, etc. by introspecting the language’s runtime type information and generating the necessary "glue" code.
-
Using ctypes for Cross-Language Calls: ctypes ช่วยให้ Python สามารถเข้าถึง functions, structures, arrays, and so on within a shared library directly.
-
Optimizing Performance with Profiling Tools: memory_profiler, line_profiler, cProfile, and other profiling tools ช่วยวิเคราะห์และปรับปรุง performance ของโปรแกรม.
-
Leveraging JIT Compilers: PyPy และ other JIT (Just-In-Time) compilers ใช้เพื่อเติบโตรูป code execution by compiling Python bytecode into machine code on the fly.
-
Using Multiprocessing for CPU-Bound Tasks: multiprocessing module ช่วยให้เขียน code ที่สามารถทำงานบนหลาย processors ในเครือข่ายที่เป็น CPU-bound.
-
Using Asyncio for I/O-Bound Tasks: asyncio module ช่วยจัดการ tasks ที่ไม่ส่งหลาย thread แต่ใช้ event loop เพื่อรับข้อมูลมาเข้าถึงหนึ่งลำดับตามคำสั่ง async/await.
-
Distributing Code with Fabric or similar tools: Fabric และ Tools like Ansible, SaltStack ช่วยในการจัดการ deployment, testing, and other repetitive tasks in a Python-centric environment.
-
Building REST APIs with Flask or Django REST framework: Flask (with extensions like Flask-RESTful or Flask-Restless) และ Django REST framework ช่วยสร้าง API's that can be consumed by web applications, mobile apps, and other clients.
-
Creating and Managing Virtual Environments: virtualenv และ venv (included in the Python standard library since Python 3.3) ช่วยในการจัดการ dependency isolation และ environment management สำหรับ Python projects.
-
Using Package Managers: pip, conda, and other package managers ช่วยจัดการ dependencies ใน Python projects, ให้ทีมติดตั้ง, อัปเก็บ, และอัพเดต packages อย่างรูปสุด.
-
Leveraging Docker Containers: Docker ช่วยในการ crea
Course Gallery




Loading charts...