I’m trying to create assets as mentioned in the ## 2. Create The Asset Hierarchy section of the Hands on tasks but I’m getting an error, although I have checked the solution and it’s exactly the same solution you have provided.
The task says:
For each geographical region, create a corresponding CDF asset that is under the "global" root asset and is associated with the "world_info" data set.
My solution:
list = []
for region in df['region'].unique():
asset = Asset(name=region, parent_id=14499569942375, data_set_id=621288550636820)
list.append(asset)
client.assets.create(list)
The error message i’m getting when running the above code:
ValueError Traceback (most recent call last) Cell In[100], line 6 3 asset = Asset(name=region, parent_id=14499569942375, data_set_id=621288550636820) 4 list.append(asset) ----> 6 client.assets.create(list) File ~/workspace/using-cognite-python-sdk/.venv/lib/python3.10/site-packages/cognite/client/_api/assets.py:432, in AssetsAPI.create(self, asset) 402 """`Create one or more assets. <https://docs.cognite.com/api/v1/#operation/createAssets>`_ 403 404 You can create an arbitrary number of assets, and the SDK will split the request into multiple requests. (...) 429 >>> res = c.assets.create(asset) 430 """ 431 utils._auxiliary.assert_type(asset, "asset", [Asset, Sequence]) --> 432 return self._create_multiple(list_cls=AssetList, resource_cls=Asset, items=asset) File ~/workspace/using-cognite-python-sdk/.venv/lib/python3.10/site-packages/cognite/client/_api_client.py:649, in APIClient._create_multiple(self, items, list_cls, resource_cls, resource_path, params, headers, extra_body_fields, limit) 646 return dumped 647 return el --> 649 summary.raise_compound_exception_if_failed_tasks( 650 task_unwrap_fn=lambda task: task[1]["items"], 651 task_list_element_unwrap_fn=unwrap_element, 652 str_format_element_fn=str_format_element, 653 )
...
255 self.key_separator, self.item_separator, self.sort_keys, 256 self.skipkeys, _one_shot) --> 257 return _iterencode(o, 0)
ValueError: Out of range float values are not JSON compliant. Make sure your data does not contain NaN(s) or +/- Inf!
Best answer by Dilini Fernando
View original