MCPcopy Create free account
hub / github.com/PowerGridModel/power-grid-model / convert_python_to_numpy

Function convert_python_to_numpy

tests/unit/utils.py:321–342  ·  view source on GitHub ↗

Convert native python data to internal numpy Args: data: data in dict or list data_type: type of data: input, update, sym_output, or asym_output Returns: A single or batch dataset for power-grid-model

(data: PythonDataset, data_type: DatasetType)

Source from the content-addressed store, hash-verified

319
320
321def convert_python_to_numpy(data: PythonDataset, data_type: DatasetType) -> Dataset:
322 """
323 Convert native python data to internal numpy
324
325 Args:
326 data: data in dict or list
327 data_type: type of data: input, update, sym_output, or asym_output
328
329 Returns:
330 A single or batch dataset for power-grid-model
331 """
332 return json_deserialize(
333 json.dumps(
334 {
335 "version": "1.0",
336 "is_batch": isinstance(data, list),
337 "attributes": {},
338 "type": data_type,
339 "data": data,
340 }
341 )
342 )

Callers 2

Calls 1

json_deserializeFunction · 0.85

Tested by 2