Tools for converting network data to pajek files.
Pajek is a file format for networks, typically stored in files with a .net
extension. It is used as input for software such as Infomap.
Install from PyPI:
pip install pajek-tools
Use the PajekWriter
object to convert a network from an edgelist in pandas DataFrame form, to a Pajek .net file:
from pajek_tools import PajekWriter writer = PajekWriter(dataframe) writer.write("output.net")
from pajek_tools import PajekWriter import pandas as pd df = pd.DataFrame([["a", "b"], ["a", "c"], ["c", "a"], ["c", "d"]], columns=["source", "target"]) writer = PajekWriter(df, directed=True, citing_colname="source", cited_colname="target") writer.write("output.net")
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.