Loaders

Pandas HDF5

Saving a Network to HDF5 is a way to share a Network or to preserve it between sessions. For example. you can build a Network using the OpenStreetMap API, then save the Network to HDF5 so you can reuse it without querying OSM again. Users will typically use the save_hdf5() and from_hdf5() methods.

Note

Only the nodes and edges of the network are saved. Points-of-interest and data attached to nodes via the set() method are not included.

You may find the Pandas HDFStore useful to save POI and other data.

When saving a Network to HDF5 it’s possible to exclude certain nodes. This can be useful when refining a network so that it includes only validated nodes. (In the current design of pandarm it’s not possible to modify a Network in place.) As an example, you can use the low_connectivity_nodes() method to identify nodes that may not be connected to the larger network, then exclude those nodes when saving to HDF5:

lcn = network.low_connectivity_nodes(10000, 10, imp_name='distance')
network.save_hdf5('mynetwork.h5', rm_nodes=lcn)

Pandas HDF5 API

Network.save_hdf5(filename, rm_nodes=None, complevel=None, complib=None)[source]

Save network data to a Pandas HDF5 file.

Only the nodes and edges of the actual network are saved, points-of-interest and data attached to nodes are not saved.

Parameters:
filenamestr
rm_nodesarray_like

A list, array, Index, or Series of node IDs that should not be saved as part of the Network.

classmethod Network.from_hdf5(filename)[source]

Load a previously saved Network from a Pandas HDF5 file.

Parameters:
filenamestr
Returns:
networkpandarm.Network
pandarm.loaders.pandash5.network_to_pandas_hdf5(network, filename, rm_nodes=None, complevel=None, complib=None)[source]

Save a Network’s data to a Pandas HDFStore.

Parameters:
networkpandarm.Network
filenamestr
rm_nodesarray_like

A list, array, Index, or Series of node IDs that should not be saved as part of the Network.

pandarm.loaders.pandash5.network_from_pandas_hdf5(cls, filename)[source]

Build a Network from data in a Pandas HDFStore.

Parameters:
clsclass

Class to instantiate, usually pandana.Network.

filenamestr
Returns:
networkpandarm.Network