Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python
Python
  1. Python Pandas - ตรวจสอบว่าช่วงใน IntervalArray มีค่าที่ระบุ (array.contains)

    ในการตรวจสอบแบบองค์ประกอบ (element-wise) ว่าช่วง (Interval) ใน IntervalArray มีค่าที่ระบุหรือไม่ ให้ใช้เมธอด array.contains() ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้าง IntervalArray จากจุดแบ่ง array = pd.arrays.IntervalArray.from_breaks([0, 1, 2, 3, 4, 5]) 3. แสดงช่ว

  2. Python Pandas - ตรวจสอบการทับซ้อนของช่วงใน IntervalArray (array.overlaps)

    ในการตรวจสอบแบบองค์ประกอบ (element-wise) ว่าช่วง (Interval) ทับซ้อนกับค่าใน IntervalArray หรือไม่ ให้ใช้เมธอด array.overlaps() ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้าง IntervalArray จากจุดแบ่ง array = pd.arrays.IntervalArray.from_breaks([0, 1, 2, 3, 4, 5]) 3. แสดงช่

  3. Python Pandas - สร้าง IntervalArray ปิดทั้งสองข้าง (array.set_closed)

    ในการสร้าง IntervalArray ใหม่ที่เหมือนเดิมแต่ปิดทั้งสองข้าง (closed=both) ให้ใช้เมธอด array.set_closed() พร้อมพารามิเตอร์ both ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้าง IntervalArray จากจุดแบ่ง array = pd.arrays.IntervalArray.from_breaks([0, 1, 2, 3, 4, 5]) 3. แสดงช่

  4. Python Pandas - ดูทรานส์โพสของดัชนี (index.T)

    ในการดูทรานส์โพส (transpose) ของดัชนี (Index) ให้ใช้คุณสมบัติ index.T ใน Pandas (สำหรับดัชนี 1 มิติ ทรานส์โพสจะคืนค่าตัวมันเอง) ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([Car, Bike, Truck, Ship, Airplane]) 3. แสดงดัชนี print(Pandas Index...\n, i

  5. Python Pandas - ดึงอาร์เรย์ข้อมูลจากดัชนี (index.values)

    ในการดึงอาร์เรย์ (NumPy array) ที่แทนข้อมูลในดัชนี (Index) ให้ใช้คุณสมบัติ index.values ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([Car, Bike, Truck, Ship, Airplane]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. ดึงอาร์เรย์ข้อมูล pr

  6. Python Pandas - ตรวจสอบว่าดัชนีเพิ่มขึ้นอย่างเดี่ยว (is_monotonic_increasing)

    ในการตรวจสอบว่าดัชนี (Index) มีค่าเพิ่มขึ้นอย่างเดี่ยว (monotonic increasing) หมายถึงค่าต่อไปเท่ากับหรือมากกว่าค่าก่อนหน้า ให้ใช้คุณสมบัติ index.is_monotonic_increasing ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([10, 20, 20, 30, 40]) 3. แสดงดัชนี

  7. Python Pandas - ตรวจสอบว่าดัชนีลดลงอย่างเดี่ยว (is_monotonic_decreasing)

    ในการตรวจสอบว่าดัชนี (Index) มีค่าลดลงอย่างเดี่ยว (monotonic decreasing) หมายถึงค่าต่อไปเท่ากับหรือน้อยกว่าค่าก่อนหน้า ให้ใช้คุณสมบัติ index.is_monotonic_decreasing ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([50, 40, 30, 30, 30]) 3. แสดงดัชนี pri

  8. Python Pandas - ตรวจสอบว่าดัชนีมีค่าไม่ซ้ำกันหรือไม่ (index.is_unique)

    ในการตรวจสอบว่าดัชนี (Index) มีค่าไม่ซ้ำกันทั้งหมด (unique) หรือไม่ ให้ใช้คุณสมบัติ index.is_unique ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([50, 40, 30, 20, 10]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. ตรวจสอบว่าค่าไม่ซ้ำกัน

  9. Python Pandas - ตรวจสอบว่าดัชนีมีค่าซ้ำหรือไม่ (index.has_duplicates)

    ในการตรวจสอบว่าดัชนี (Index) มีค่าซ้ำกันหรือไม่ ให้ใช้คุณสมบัติ index.has_duplicates ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([Car, Bike, Truck, Car, Airplane]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. ตรวจสอบว่ามีค่าซ้ำหรือไม

  10. Python Pandas - ตรวจสอบว่าดัชนีมี NaN หรือไม่ (index.hasnans)

    ในการตรวจสอบว่าดัชนี (Index) มีค่า NaN หรือไม่ ให้ใช้คุณสมบัติ index.hasnans ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd import numpy as np 2. สร้างดัชนีที่มี NaN index = pd.Index([Car, Bike, np.nan, Car, np.nan, Ship]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4.

  11. Python Pandas - ดู dtype ของข้อมูลดัชนี (index.dtype)

    ในการดูออบเจกต์ dtype ของข้อมูลในดัชนี (Index) ให้ใช้คุณสมบัติ index.dtype ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([Car, Bike, Shop, Car, Airplace, Truck]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. ดู dtype ของข้อมูล print(\nT

  12. Python Pandas - ดูชนิดข้อมูลที่อนุมานจากค่า (index.inferred_type)

    ในการดูสตริงที่บ่งชี้ชนิดข้อมูลที่อนุมานจากค่าในดัชนี (Index) ให้ใช้คุณสมบัติ index.inferred_type ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd import numpy as np 2. สร้างดัชนี (มี NaN) index = pd.Index([Car, Bike, np.nan, Car, np.nan, Ship, None, None]) 3. แสดงดัชนี pr

  13. Python Pandas - หารูปร่างของข้อมูลดัชนี (index.shape)

    ในการหาทูเพิล (tuple) ที่แสดงรูปร่างของข้อมูลในดัชนี (Index) ให้ใช้คุณสมบัติ index.shape ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([Car, Bike, Truck, Car, Airplane]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. หารูปร่างของข้อมูล p

  14. Python Pandas - ตั้งชื่อดัชนี (index.set_names)

    ในการตั้งชื่อให้ดัชนี (Index) ที่สร้างไว้แล้ว ให้ใช้เมธอด index.set_names() และระบุชื่อที่ต้องการเป็นอาร์กิวเมนต์ ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([Car, Bike, Truck, Car, Airplane]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. ตั้งช

  15. Python Pandas - หาจำนวนไบต์ของข้อมูลดัชนี (index.nbytes)

    ในการหาจำนวนไบต์ของข้อมูลในดัชนี (Index) ให้ใช้คุณสมบัติ index.nbytes ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([15, 25, 35, 45, 55]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. หาจำนวนไบต์ print(\nReturn the bytes...\n, index.nby

  16. Python Pandas - หาจำนวนมิติของข้อมูลดัชนี (index.ndim)

    ในการหาจำนวนมิติของข้อมูลในดัชนี (Index) ให้ใช้คุณสมบัติ index.ndim ใน Pandas (ดัชนีเสมอมี 1 มิติ) ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([15, 25, 35, 45, 55]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. หาจำนวนมิติ print(\nReturn the di

  17. Python Pandas - หาจำนวนองค์ประกอบในดัชนี (index.size)

    ในการหาจำนวนองค์ประกอบในดัชนี (Index) ให้ใช้คุณสมบัติ index.size ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([15, 25, 35, 45, 55]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. หาจำนวนองค์ประกอบ print(\nNumber of elements in the index

  18. Python Pandas - ตรวจสอบว่าดัชนีว่างหรือไม่ (index.empty)

    ในการตรวจสอบว่าดัชนี (Index) ว่างเปล่าหรือไม่ (มี 0 องค์ประกอบ) ให้ใช้คุณสมบัติ index.empty ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนีว่าง index = pd.Index([]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. ตรวจสอบว่าดัชนีว่าง print(\nIs the index emp

  19. Python Pandas - ดูการใช้หน่วยความจำของดัชนี (index.memory_usage)

    ในการดูการใช้หน่วยความจำของค่าในดัชนี (Index) ให้ใช้เมธอด index.memory_usage() ใน Pandas ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([15, 25, 35, 45, 55]) 3. แสดงดัชนี print(Pandas Index...\n, index) 4. ดูการใช้หน่วยความจำ print(\nThe memory usag

  20. Python Pandas - ตรวจสอบว่าค่าทั้งหมดในดัชนีเป็น True (index.all)

    ในการตรวจสอบว่าค่าทั้งหมดในดัชนี (Index) เป็น True ให้ใช้เมธอด index.all() ใน Pandas (ค่าที่ไม่ใช่ 0 ถือเป็น True, ค่า 0 ถือเป็น False) ขั้นตอนการทำงาน 1. นำเข้าไลบรารีที่จำเป็น import pandas as pd 2. สร้างดัชนี index = pd.Index([15, 25, 35, 45, 55]) 3. แสดงดัชนี print(Pandas Index...\n, index)

Total 9001 -คอมพิวเตอร์  FirstPage PreviousPage NextPage LastPage CurrentPage:382/451  20-คอมพิวเตอร์/Page Goto:1 376 377 378 379 380 381 382 383 384 385 386 387 388