power-grid-model-io 1.2.18__py3-none-any.whl → 1.2.20__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of power-grid-model-io might be problematic. Click here for more details.

@@ -144,12 +144,13 @@ class PandaPowerConverter(BaseConverter[PandaPowerData]):
144
144
  extra_info[pgm_id] = {"id_reference": {"table": pp_table, "index": pp_idx}}
145
145
  for component_data in self.pgm_input_data.values():
146
146
  for attr_name in component_data.dtype.names:
147
- if NODE_REF_RE.fullmatch(attr_name):
148
- for pgm_id, node_id in component_data[["id", attr_name]]:
149
- if pgm_id not in extra_info:
150
- extra_info[pgm_id] = {attr_name: node_id}
151
- else:
152
- extra_info[pgm_id][attr_name] = node_id
147
+ if not NODE_REF_RE.fullmatch(attr_name):
148
+ continue
149
+ for pgm_id, node_id in component_data[["id", attr_name]]:
150
+ if pgm_id in extra_info:
151
+ extra_info[pgm_id][attr_name] = node_id
152
+ else:
153
+ extra_info[pgm_id] = {attr_name: node_id}
153
154
 
154
155
  def _extra_info_to_idx_lookup(self, extra_info: ExtraInfo):
155
156
  """
@@ -478,7 +478,7 @@ class TabularConverter(BaseConverter[TabularData]):
478
478
  value_column=sub_def["value_column"],
479
479
  )
480
480
  elif isinstance(sub_def, list):
481
- col_data = self._parse_pandas_function(data=data, table=table, function=name, col_def=sub_def)
481
+ col_data = self._parse_pandas_function(data=data, table=table, fn_name=name, col_def=sub_def)
482
482
  elif isinstance(sub_def, dict):
483
483
  col_data = self._parse_function(data=data, table=table, function=name, col_def=sub_def)
484
484
  else:
@@ -549,13 +549,13 @@ class TabularConverter(BaseConverter[TabularData]):
549
549
 
550
550
  return col_data.apply(auto_id, axis=1, raw=True)
551
551
 
552
- def _parse_pandas_function(self, data: TabularData, table: str, function: str, col_def: List[Any]) -> pd.DataFrame:
552
+ def _parse_pandas_function(self, data: TabularData, table: str, fn_name: str, col_def: List[Any]) -> pd.DataFrame:
553
553
  """Special vectorized functions.
554
554
 
555
555
  Args:
556
556
  data: The data
557
557
  table: The name of the current table
558
- function: The name of the function.
558
+ fn_name: The name of the function.
559
559
  col_def: The definition of the function arguments
560
560
 
561
561
  Returns:
@@ -564,15 +564,15 @@ class TabularConverter(BaseConverter[TabularData]):
564
564
  assert isinstance(col_def, list)
565
565
 
566
566
  # "multiply" is an alias for "prod"
567
- if function == "multiply":
568
- function = "prod"
567
+ if fn_name == "multiply":
568
+ fn_name = "prod"
569
569
 
570
570
  col_data = self._parse_col_def(data=data, table=table, col_def=col_def, extra_info=None)
571
571
 
572
572
  try:
573
- fn_ptr = getattr(col_data, function)
573
+ fn_ptr = getattr(col_data, fn_name)
574
574
  except AttributeError as ex:
575
- raise ValueError(f"Pandas DataFrame has no function '{function}'") from ex
575
+ raise ValueError(f"Pandas DataFrame has no function '{fn_name}'") from ex
576
576
 
577
577
  # If the function expects an 'other' argument, apply the function per column (e.g. divide)
578
578
  empty = inspect.Parameter.empty
@@ -581,12 +581,12 @@ class TabularConverter(BaseConverter[TabularData]):
581
581
  n_columns = col_data.shape[1] if col_data.ndim > 1 else 1
582
582
  result = col_data.iloc[:, 0]
583
583
  for i in range(1, n_columns):
584
- result = getattr(result, function)(other=col_data.iloc[:, i])
584
+ result = getattr(result, fn_name)(other=col_data.iloc[:, i])
585
585
  return pd.DataFrame(result)
586
586
 
587
587
  # If the function expects any argument
588
588
  if any(param.default == empty for name, param in fn_sig.parameters.items() if name != "kwargs"):
589
- raise ValueError(f"Invalid pandas function DataFrame.{function}")
589
+ raise ValueError(f"Invalid pandas function DataFrame.{fn_name}")
590
590
 
591
591
  return pd.DataFrame(fn_ptr(axis=1))
592
592
 
@@ -203,7 +203,7 @@ class TabularData:
203
203
  """
204
204
  Mimic the dictionary .items() function
205
205
 
206
- Returns: An generator of the table names and the raw table data
206
+ Returns: A generator of the table names and the raw table data
207
207
  """
208
208
 
209
209
  # Note: PyCharm complains about the type, but it is correct, as an ItemsView extends from
@@ -100,8 +100,7 @@ def both_zeros_to_nan(value: float, other_value: float) -> float:
100
100
  value 0 value nan
101
101
  nan nan value nan
102
102
  """
103
- if value == 0:
104
- if other_value == 0 or not has_value(other_value):
105
- _LOG.warning("0 replaced to nan")
106
- return float("nan")
103
+ if value == 0 and (other_value == 0 or not has_value(other_value)):
104
+ _LOG.warning("0 replaced to nan")
105
+ return float("nan")
107
106
  return value
@@ -42,7 +42,7 @@ node The word 'node'
42
42
  $ End of the string
43
43
  """
44
44
 
45
- PVS_EFFICIENCY_TYPE_RE = re.compile(r"[ ,..]1 pu: (95|97) %")
45
+ PVS_EFFICIENCY_TYPE_RE = re.compile(r"[ ,.]1 pu: (95|97) %")
46
46
  r"""
47
47
  Regular expressions to match the efficiency type percentage at 1 pu, eg:
48
48
  - 0,1 pu: 93 %; 1 pu: 97 %
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: power-grid-model-io
3
- Version: 1.2.18
3
+ Version: 1.2.20
4
4
  Summary: Power Grid Model Input/Output
5
5
  Author-email: Alliander Dynamic Grid Calculation <dynamic.grid.calculation@alliander.com>
6
6
  License: MPL-2.0
@@ -67,15 +67,15 @@ SPDX-License-Identifier: MPL-2.0
67
67
  For detailed documentation, see [Read the Docs](https://power-grid-model-io.readthedocs.io/en/stable/index.html).
68
68
 
69
69
  # Examples
70
- * [PGM JSON Example](https://github.com/alliander-opensource/power-grid-model-io/blob/470e4abecf3a0f78f86d125c10fc9d8af73f01b3/docs/examples/pgm_json_example.ipynb)
70
+ * [PGM JSON Example](https://github.com/alliander-opensource/power-grid-model-io/blob/1db236cf48271a43ee754212193e936b024fd18f/docs/examples/pgm_json_example.ipynb)
71
71
 
72
72
 
73
73
  # License
74
- This project is licensed under the Mozilla Public License, version 2.0 - see [LICENSE](https://github.com/alliander-opensource/power-grid-model-io/blob/470e4abecf3a0f78f86d125c10fc9d8af73f01b3/LICENSE) for details.
74
+ This project is licensed under the Mozilla Public License, version 2.0 - see [LICENSE](https://github.com/alliander-opensource/power-grid-model-io/blob/1db236cf48271a43ee754212193e936b024fd18f/LICENSE) for details.
75
75
 
76
76
  # Contributing
77
- Please read [CODE_OF_CONDUCT](https://github.com/alliander-opensource/power-grid-model-io/blob/470e4abecf3a0f78f86d125c10fc9d8af73f01b3/CODE_OF_CONDUCT.md) and [CONTRIBUTING](https://github.com/alliander-opensource/power-grid-model-io/blob/470e4abecf3a0f78f86d125c10fc9d8af73f01b3/CONTRIBUTING.md) for details on the process
77
+ Please read [CODE_OF_CONDUCT](https://github.com/alliander-opensource/power-grid-model-io/blob/1db236cf48271a43ee754212193e936b024fd18f/CODE_OF_CONDUCT.md) and [CONTRIBUTING](https://github.com/alliander-opensource/power-grid-model-io/blob/1db236cf48271a43ee754212193e936b024fd18f/CONTRIBUTING.md) for details on the process
78
78
  for submitting pull requests to us.
79
79
 
80
80
  # Contact
81
- Please read [SUPPORT](https://github.com/alliander-opensource/power-grid-model-io/blob/470e4abecf3a0f78f86d125c10fc9d8af73f01b3/SUPPORT.md) for how to connect and get into contact with the Power Gird Model IO project.
81
+ Please read [SUPPORT](https://github.com/alliander-opensource/power-grid-model-io/blob/1db236cf48271a43ee754212193e936b024fd18f/SUPPORT.md) for how to connect and get into contact with the Power Gird Model IO project.
@@ -6,9 +6,9 @@ power_grid_model_io/config/excel/vision_en.yaml,sha256=SqzFUrzd-QQpQtselfWTZOuNO
6
6
  power_grid_model_io/config/excel/vision_nl.yaml,sha256=x_m8nHokSlLT35-xwZrSpZEvUXVjMWsrZ0acV8DLizY,19128
7
7
  power_grid_model_io/converters/__init__.py,sha256=WKvQi375_pb1I4x36aTUvRjAqXHNNlbg2yX8P0fvvsA,424
8
8
  power_grid_model_io/converters/base_converter.py,sha256=1eljmenQSZx4hik4xwVJKFPwEVTx2lW1d965VykZnIQ,4927
9
- power_grid_model_io/converters/pandapower_converter.py,sha256=mG8p-VQYXbKuBr11EdbE0WHCG97ezrOOzyu6gRjmTd8,76435
9
+ power_grid_model_io/converters/pandapower_converter.py,sha256=nY_6czzsz9QHa-O_cGBzTMd_uyCGOBOEJ9NY3-F62eE,76444
10
10
  power_grid_model_io/converters/pgm_json_converter.py,sha256=lwlnGNdODL_J1eD946kv8VzZYUhGudHSdt-92D7djrs,11780
11
- power_grid_model_io/converters/tabular_converter.py,sha256=mOgq5hWBShNoW77km_ClPpZJ9Lbkol0gMDgHYYFtYcI,28834
11
+ power_grid_model_io/converters/tabular_converter.py,sha256=iKz0K0SNI7GozXirqQVxBuHVzmGlzq1qq3VPcFBwB8Q,28825
12
12
  power_grid_model_io/converters/vision_excel_converter.py,sha256=EXxFebNiKPLYMU4m1aIf4bccSYCU6EiVUvvlvXc7Gm8,2322
13
13
  power_grid_model_io/data_stores/__init__.py,sha256=4RCCaYmi3VSdnAYw3RGxH73K3Jez5VUymiWg-zXqj_c,154
14
14
  power_grid_model_io/data_stores/base_data_store.py,sha256=NQsw-g8HerFb7t3O4yuvFGirb8z_Zcq9J0ViKcJK1U0,1383
@@ -18,9 +18,9 @@ power_grid_model_io/data_stores/json_file_store.py,sha256=vmo25AiCIy16HDF8S5ZZKu
18
18
  power_grid_model_io/data_stores/vision_excel_file_store.py,sha256=d5J6ClvIpef_JwKcqCilzYU411IR8Zju6R9Dc4j0KXQ,821
19
19
  power_grid_model_io/data_types/__init__.py,sha256=s5GL9Q3P1Y2tU2S5ekQ2KbS3TetIvW1414xbZ1Zia3s,399
20
20
  power_grid_model_io/data_types/_data_types.py,sha256=BnqY6vbiivmvh_fLYY6enj3xRluL674xLScF0ATEGPs,1680
21
- power_grid_model_io/data_types/tabular_data.py,sha256=BC20WzbV1V03KD_BmfxwDKH4X_X_sbQ97PuUXz2Y7wA,8356
21
+ power_grid_model_io/data_types/tabular_data.py,sha256=6CIPouIL0t-gG3VaqUv1G7pbLPTOgZ3H04Xn-QlPciY,8355
22
22
  power_grid_model_io/functions/__init__.py,sha256=LQKpnYqnZhMHb9QwWTTGiMadwl3e6jMSEzJf6TlIZk0,511
23
- power_grid_model_io/functions/_functions.py,sha256=J0KiqU_V3lniwNvYbFhF2_iOz5ug9_KahtlnM1xyeHs,2873
23
+ power_grid_model_io/functions/_functions.py,sha256=BNFvNaVuXRBWyHgkTuoxm_UPqx55ZufMtq54SAz04K0,2859
24
24
  power_grid_model_io/functions/phase_to_phase.py,sha256=oaDRoPg6okII0rq8klPM085DF5pSmIDqlSiY9l-L5E8,6296
25
25
  power_grid_model_io/mappings/__init__.py,sha256=4RCCaYmi3VSdnAYw3RGxH73K3Jez5VUymiWg-zXqj_c,154
26
26
  power_grid_model_io/mappings/field_mapping.py,sha256=Ho70tft8nXdUPiRpLusQIle-D_XZan7s-Sa27FQo3Uo,1581
@@ -33,9 +33,9 @@ power_grid_model_io/utils/auto_id.py,sha256=fk-w1rnuvFbg8_hnteZSNa0j8p5xIF-bFDlQ
33
33
  power_grid_model_io/utils/dict.py,sha256=Y5fCB22qIwFVHinUq-TO1eXeNWU177sVPyOVVaAzl7o,1030
34
34
  power_grid_model_io/utils/json.py,sha256=Fw9GhCiwk4sXw48ljPOkWAR0LaRkdA8ZkUQu-K0z0vU,3343
35
35
  power_grid_model_io/utils/modules.py,sha256=ZB8IIK96VuJk5FkoclrUCuXOSsGeVqT3B01bBAcodeU,944
36
- power_grid_model_io/utils/regex.py,sha256=0uJDRSfggmDFu_nip1Oge8NUXBQ_8e-3HTLdB8niAkQ,1728
37
- power_grid_model_io-1.2.18.dist-info/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
38
- power_grid_model_io-1.2.18.dist-info/METADATA,sha256=ciDelu3ZOiR63OFFZ_hsYZEhSV8uP7e0eB2UUXWOJuw,5679
39
- power_grid_model_io-1.2.18.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
40
- power_grid_model_io-1.2.18.dist-info/top_level.txt,sha256=7sq9VveemMm2R0RgTBa4tH8y_xF4_1hxbufmX9OjCTo,20
41
- power_grid_model_io-1.2.18.dist-info/RECORD,,
36
+ power_grid_model_io/utils/regex.py,sha256=dbKTyQMaTWou9Cvk35R2_9SJlz6Rd5rfH6Xy3BCeFJg,1727
37
+ power_grid_model_io-1.2.20.dist-info/LICENSE,sha256=7Pm2fWFFHHUG5lDHed1vl5CjzxObIXQglnYsEdtjo_k,14907
38
+ power_grid_model_io-1.2.20.dist-info/METADATA,sha256=1DW3KbRA1-YstQtQKN-KP17NBxhz04mAquV5ep-2Urk,5679
39
+ power_grid_model_io-1.2.20.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
40
+ power_grid_model_io-1.2.20.dist-info/top_level.txt,sha256=7sq9VveemMm2R0RgTBa4tH8y_xF4_1hxbufmX9OjCTo,20
41
+ power_grid_model_io-1.2.20.dist-info/RECORD,,