elm.web.rhub.ProfilesList
- class ProfilesList(url, n_pages=1)[source]
Bases:
list
Class to retrieve and handle multiple profiles from an API URL. This class requires setting an ‘RHUB_API_KEY’ environment variable to access the Pure Web Service. The API key can be obtained by contacting an NREL library representative: Library@nrel.gov.
- Parameters:
url (str) –
- Research Hub API URL to request, see this for details:
https://research-hub.nrel.gov/ws/api/524/api-docs/index.html
n_pages (int) – Number of pages to get from the API. Typical response has 20 entries per page. Default of 1 ensures that this class doesnt hang on a million responses.
Methods
append
(object, /)Append object to the end of the list.
clear
()Remove all items from list.
copy
()Return a shallow copy of the list.
count
(value, /)Return number of occurrences of value.
download
(out_dir)Download all profiles from the records in this object into a directory.
extend
(iterable, /)Extend list by appending elements from the iterable.
index
(value[, start, stop])Return first index of value.
insert
(index, object, /)Insert object before index.
meta
()Get a meta dataframe with details on all of the profiles.
pop
([index])Remove and return item at index (default last).
remove
(value, /)Remove first occurrence of value.
reverse
()Reverse IN PLACE.
sort
(*[, key, reverse])Sort the list in ascending order and return None.
- meta()[source]
Get a meta dataframe with details on all of the profiles.
- Returns:
df (pd.DataFrame) – Dataframe containing all metadata information.
- download(out_dir)[source]
Download all profiles from the records in this object into a directory. TXT files will be given file names based on researcher ID.
- Parameters:
out_dir (str) – Directory to download TXT files to. This directory will be created if it does not already exist.
- __add__(value, /)
Return self+value.
- __mul__(value, /)
Return self*value.
- append(object, /)
Append object to the end of the list.
- clear()
Remove all items from list.
- copy()
Return a shallow copy of the list.
- count(value, /)
Return number of occurrences of value.
- extend(iterable, /)
Extend list by appending elements from the iterable.
- index(value, start=0, stop=9223372036854775807, /)
Return first index of value.
Raises ValueError if the value is not present.
- insert(index, object, /)
Insert object before index.
- pop(index=-1, /)
Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
- remove(value, /)
Remove first occurrence of value.
Raises ValueError if the value is not present.
- reverse()
Reverse IN PLACE.
- sort(*, key=None, reverse=False)
Sort the list in ascending order and return None.
The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).
If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.
The reverse flag can be set to sort in descending order.