Open robertobarrio98 opened 2 years ago
Dear @robertobarrio98 could you please provide a minimal example where this problem occur? I cannot reproduce it. The following code
import pandapower as pp
import pandapower.networks as pn
net = pn.case9()
subnet = pp.select_subnet(net, [0, 3, 4, 5])
print(type(subnet.bus.index[0]))
print(subnet.bus.index.dtype)
leads to
<class 'numpy.int64'>
int64
on my machine (with pp v2.10.1 and v2.11.1 as well).
It changes the bus indexes dtype from 'int64' to 'uint64'. With this change, if you want to pass that subnet to a networkx graph with impedances added as weights, using:
topology.create_nxgraph(subnet, calc_branch_impedances=True)
an error will raise: "TypeError: 'numpy.float64' object cannot be interpreted as an integer"
Tried changing manually the type to int64 with
subnet.bus.index = subnet.bus.index.astype('int64')
and then it worked fine