put_facts¶
-
FactsService.
put_facts
(building_id, data=Empty DataFrame Columns: [fact_time, fact_value, native_name] Index: [])¶ Insert facts for a building.
API documentation: http://facts.prod.ecorithm.com/api/v1/#/Facts/put
Args:
building_id (str): Building id to get facts for.
Example: 1
data (DataFrame): DataFrame with data to upload.
Example:
index fact_time fact_value native-name ===== ================ ========== ============= 0 2017-12-20 00:00 1 native-name-1 1 2017-12-21 00:00 2 native-name-2
Note
If errors are present, a message key will be returned.
- Example:
{ ‘message’: {‘field_errors’: [‘native-name-1’]} }
Example Usage:
>>> from eco_connect import FactsService >>> import pandas as pd >>> facts_service = FactsService() >>> data = pd.DataFrame(data=[['2017-12-20 00:00', 1, 'native-name-1'], ['2017-12-21 00:00', 2, 'native-name-2']], columns=['fact_time', 'fact_value', 'native_name']) >>> fs.put_facts(building_id=26, data=data) {'data': {'building_id': 26, 'max_process_timestamp': '2017-12-21 00:00', 'min_process_timestamp': '2017-12-21 00:00', 'records_stored': 1}, 'message': {'field_errors': ['native-name-1']}}