Convert results to pandas DataFrame The DataFrame has two columns, "node" with the node ids and "value" with the corresponding values. Returns: DataFrame: A Pandas DataFrame.
(&self, py: Python<'py>)
| 410 | /// Returns: |
| 411 | /// DataFrame: A Pandas DataFrame. |
| 412 | fn to_df<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> { |
| 413 | let pandas = PyModule::import(py, "pandas")?; |
| 414 | let columns = PyDict::new(py); |
| 415 | columns.set_item("node", self.inner.nodes().id())?; |
| 416 | columns.set_item("value", self.values())?; |
| 417 | pandas.call_method("DataFrame", (columns,), None) |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | #[pymethods] |