feat: update create_blacklist_from_qdf function signature to include group_by_cid and blacklist_name parameters

This commit is contained in:
Palash Tyagi 2025-04-16 01:36:56 +01:00
parent 25192e425d
commit 7d4c198067

View File

@ -1,7 +1,7 @@
use pyo3::types::IntoPyDict;
use pyo3::{prelude::*, types::PyDict};
use pyo3_polars::{PyDataFrame, PySeries};
/// Python wrapper for [`crate::utils::qdf`] module.
#[allow(deprecated)]
#[pymodule]
@ -37,10 +37,20 @@ pub fn get_bdates_series_default_opt(
}
#[allow(deprecated)]
#[pyfunction(signature = (df, metric = None))]
pub fn create_blacklist_from_qdf(df: PyDataFrame, metric: Option<String>) -> PyResult<PyObject> {
let result = crate::utils::qdf::blacklist::create_blacklist_from_qdf(&df.into(), metric)
.map_err(|e| PyErr::new::<pyo3::exceptions::PyValueError, _>(format!("{}", e)))?;
#[pyfunction(signature = (df, group_by_cid=None, blacklist_name=None, metric=None))]
pub fn create_blacklist_from_qdf(
df: PyDataFrame,
group_by_cid: Option<bool>,
blacklist_name: Option<String>,
metric: Option<String>,
) -> PyResult<PyObject> {
let result = crate::utils::qdf::blacklist::create_blacklist_from_qdf(
&df.into(),
group_by_cid,
blacklist_name,
metric,
)
.map_err(|e| PyErr::new::<pyo3::exceptions::PyValueError, _>(format!("{}", e)))?;
Python::with_gil(|py| {
let dict = PyDict::new(py);
// for (key, (start_date, end_date)) in result {