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>)
| 373 | /// Returns: |
| 374 | /// DataFrame: A Pandas DataFrame. |
| 375 | fn to_df<'py>(&self, py: Python<'py>) -> PyResult<Bound<'py, PyAny>> { |
| 376 | let pandas = PyModule::import(py, "pandas")?; |
| 377 | let columns = PyDict::new(py); |
| 378 | columns.set_item("node", self.inner.nodes().id())?; |
| 379 | columns.set_item("value", self.values())?; |
| 380 | pandas.call_method("DataFrame", (columns,), None) |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | impl |