xgi-org / xgi

CompleX Group Interactions (XGI) is a Python package for higher-order networks.
https://xgi.readthedocs.io
Other
180 stars 28 forks source link

access stat name from IDStat object #454

Closed maximelucas closed 11 months ago

maximelucas commented 1 year ago

There is no natural way to access a stat's name from an IDStat object.

For example, for the object

H.nodes.degree
# --> NodeStat("degree")

the only way I found to retrieve the stat name "degree" is by doing H.nodes.degree.aspandas()._name. Something like H.nodes.degree.name() would be more natural.

(Corollary question: is it possible right now to compute a stat by using it's name as a string? Like H.nodes.stat("degree"). We cannot, right?)

maximelucas commented 11 months ago

This exists already actually.. just do H.nodes.degree.name.

I'll open another issue for the corollary.