pub fn apply_to_dataframe(
py: Python<'_>,
df: Py<PyAny>,
func: Py<PyAny>,
) -> PyResult<Py<PyAny>>Expand description
Apply a scirs2 function to each column of a DataFrame
ยงExample (Python)
import pandas as pd
import scirs2
df = pd.DataFrame({
'A': [1, 2, 3, 4, 5],
'B': [2, 4, 6, 8, 10],
'C': [1, 3, 5, 7, 9]
})
# Calculate mean of each column
means = scirs2.apply_to_dataframe(df, scirs2.mean_py)