deflex.nodes2table

deflex.nodes2table(results, no_sums=False)[source]

Get a table with all nodes as a MultiIndex with the sum of their in an out flows.

The index contains the following levels: class, category, tag, subtag, region

The sums can be found in the columns “in” and “out”.

Parameters:
  • results (dict) – Deflex results dictionary.
  • no_sums (bool) – Set to False to get an empty DataFrame with no sums (default: True)
Returns:

Table with all nodes and sums

Return type:

pandas.DataFrame

Examples

>>> import deflex as dflx
>>> fn = dflx.fetch_test_files("de03_fictive.dflx")
>>> my_results = dflx.restore_results(fn)
>>> all_nodes = nodes2table(my_results)
>>> len(all_nodes)
226
>>> all_nodes.to_csv("your/path/file.csv")  # doctest: +SKIP