ee.Dictionary.remove

แสดงพจนานุกรมที่นำคีย์ที่ระบุออกแล้ว

การใช้งานการคืนสินค้า
Dictionary.remove(selectors, ignoreMissing)พจนานุกรม
อาร์กิวเมนต์ประเภทรายละเอียด
ดังนี้ dictionaryพจนานุกรม
selectorsรายการรายการชื่อคีย์หรือนิพจน์ทั่วไปของชื่อคีย์ที่จะนำออก
ignoreMissingบูลีน ค่าเริ่มต้น: falseละเว้นตัวเลือกที่ไม่ตรงกับคีย์อย่างน้อย 1 รายการ

ตัวอย่าง

โปรแกรมแก้ไขโค้ด (JavaScript)

// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = ee.Dictionary({
  B1: 182,
  B2: 219,
  B3: 443
});

print('Dictionary with selected keys removed', dict.remove(['B2', 'B3']));

print('Set ignoreMissing as true to avoid an unmatched key error',
      dict.remove({selectors: ['B2', 'B3', 'Region'], ignoreMissing: true}));

การตั้งค่า Python

ดูข้อมูลเกี่ยวกับ Python API และการใช้ geemap เพื่อการพัฒนาแบบอินเทอร์แอกทีฟได้ที่หน้า สภาพแวดล้อม Python

import ee
import geemap.core as geemap

Colab (Python)

# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = ee.Dictionary({
    'B1': 182,
    'B2': 219,
    'B3': 443
})

print('Dictionary with selected keys removed:',
      dic.remove(['B2', 'B3']).getInfo())

dic_subset = dic.remove(**{'selectors': ['B2', 'B3', 'Region'],
                          'ignoreMissing': True})
print('Set ignoreMissing as true to avoid an unmatched key error:',
      dic_subset.getInfo())