pypsa.Network.equals

Contents

pypsa.Network.equals#

Network.equals(other: Any, log_mode: str = 'silent') bool#

Check for equality of two networks.

Parameters:
  • other (Any) – The other network to compare with.

  • log_mode (str, default="silent") – Controls how differences are reported: - ‘silent’: No logging, just returns True/False - ‘verbose’: Prints differences but doesn’t raise errors - ‘strict’: Raises ValueError on first difference

Raises:

ValueError – If log_mode is ‘strict’ and components are not equal.

Returns:

True if the networks are equal, False otherwise.

Return type:

bool

Examples

>>> n1 = pypsa.Network()
>>> n2 = pypsa.Network()
>>> n1.add("Bus", "bus1")
Index(['bus1'], dtype='object')
>>> n2.add("Bus", "bus2")
Index(['bus2'], dtype='object')
>>> n1.equals(n2)
False