Record Collection
Bases: DataFrame
A RecordCollection is an extention of a Pandas DataFrame.
It can be used in precisely the same way as a Pandas DataFrame but has a few extra useful constructors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_scope |
CollectionScope | None
|
params for generating api query for pagination |
required |
_page |
int | None
|
if generated from an API query, the current page of the query. |
required |
Source code in tz/client/record.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
from_tz_records(records)
classmethod
Instiate an RecordCollection from a list of Records.
Source code in tz/client/record.py
87 88 89 90 91 |
|
next_page()
Paginate through records. The Record collection must have a _scope
.
Returns the next page of records and concatenates them in-place to the current collection.
Source code in tz/client/record.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
search(node_id=None, public=True, valid_timestamp_start=None, valid_timestamp_end=None, provenance_slug=None, datum_type=None, datum_detail=None, node_type=None, technology=None, limit=10, page=0)
classmethod
Instantiate a RecordCollection from a node or technology.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id |
str
|
The id of the node to retieve records for. |
None
|
public |
bool
|
Whether to include public records. |
True
|
valid_timestamp_start |
datetime
|
Start timestamp of record validity. |
None
|
valid_timestamp_end |
datetime
|
End timestamp of record validity. |
None
|
provenance_slug |
list[str]
|
Provenance of the record (e.g. 'Copernicus-Landuse'). |
None
|
datum_type |
list[str]
|
Datum type of the record (e.g. 'Landuse'). |
None
|
datum_detail |
list[str]
|
Datum detail of the record. |
None
|
node_type |
list[str]
|
Node type of the record (e.g. 'country'). |
None
|
technology |
str | None
|
Technology slug of the record (e.g. 'coal'). |
None
|
limit |
int
|
The maximum number of search results to return. |
10
|
page |
int
|
The page number of search results to return. |
0
|
Returns: RecordCollection: A pandas-dataframe extension for TZ records.
Source code in tz/client/record.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
to_tz_records()
Instantiate a list of Records from an RecordCollection.
Source code in tz/client/record.py
108 109 110 |
|