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
Code Editor (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('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
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('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())