|
| 1 | +use crate::boolean::BooleanList; |
| 2 | +use crate::floatings::FloatList64; |
| 3 | +use crate::integers::IntegerList64; |
| 4 | +use crate::string::StringList; |
| 5 | +use pyo3::prelude::*; |
| 6 | +use std::collections::HashSet; |
| 7 | +use std::iter::FromIterator; |
| 8 | + |
| 9 | +#[pyfunction] |
| 10 | +pub fn read_csv(py: Python) -> Vec<PyObject> { |
| 11 | + // This is an example implementation of `read_csv` function, which will return |
| 12 | + // PyList[BooleanList[True, False, None], IntegerList64[2, 3, None], |
| 13 | + // FloatList64[2.0, 3.0, None], StringList['foo', 'bar', None]] |
| 14 | + let blist = BooleanList::new(vec![true, false, false], HashSet::from_iter(vec![2])); |
| 15 | + let ilist = IntegerList64::new(vec![2, 3, 0], HashSet::from_iter(vec![2])); |
| 16 | + let flist = FloatList64::new(vec![2.0, 3.0, 0.0], HashSet::from_iter(vec![2])); |
| 17 | + let slist = StringList::new( |
| 18 | + vec!["foo".to_string(), "bar".to_string(), "".to_string()], |
| 19 | + HashSet::from_iter(vec![2]), |
| 20 | + ); |
| 21 | + let mut result: Vec<PyObject> = Vec::new(); |
| 22 | + result.push(blist.into_py(py)); |
| 23 | + result.push(ilist.into_py(py)); |
| 24 | + result.push(flist.into_py(py)); |
| 25 | + result.push(slist.into_py(py)); |
| 26 | + return result; |
| 27 | +} |
0 commit comments