ee.Dictionary.values
Returns the values of a dictionary as a list. If no keys are specified, all values are returned in the natural ordering of the dictionary's keys.
Usage | Returns |
---|
Dictionary.values(keys) | List |
Argument | Type | Details |
---|
this: dictionary | Dictionary | |
keys | List, default: null | |
Examples
// A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
var dict = ee.Dictionary({
B1: 182,
B2: 219,
B3: 443
});
print('Values for selected keys converted to ee.List',
dict.values(['B1', 'B2']));
print('Values for all keys converted to ee.List', dict.values());
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
# A dictionary (e.g. results of ee.Image.reduceRegion of an S2 image).
dic = ee.Dictionary({
'B1': 182,
'B2': 219,
'B3': 443
})
print('Values for selected keys converted to ee.List:',
dic.values(['B1', 'B2']).getInfo())
print('Values for all keys converted to ee.List:', dic.values().getInfo())
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-13 UTC.
[null,null,["Last updated 2024-07-13 UTC."],[[["`Dictionary.values()` returns the values of a dictionary as a list in the natural ordering of the dictionary's keys."],["You can specify a list of keys to retrieve only the values corresponding to those keys."],["If no keys are specified, all values in the dictionary are returned."],["The returned value is an `ee.List` object."]]],["The function `dictionary.values()` extracts values from a dictionary and returns them as a list. If specific keys are provided as arguments, only the corresponding values are returned; otherwise, all values are included, maintaining the dictionary's key order. The provided examples demonstrate retrieving values for selected keys (e.g., 'B1', 'B2') and for all keys within a dictionary. Both Javascript and python examples are given.\n"]]