ext/polars/src/series.rs in polars-df-0.1.1 vs ext/polars/src/series.rs in polars-df-0.1.2
- old
+ new
@@ -114,15 +114,14 @@
init_method_opt!(new_opt_i64, Int64Type, i64);
init_method_opt!(new_opt_f32, Float32Type, f32);
init_method_opt!(new_opt_f64, Float64Type, f64);
impl RbSeries {
- pub fn new_str(name: String, val: RArray, _strict: bool) -> RbResult<Self> {
- let v = val.try_convert::<Vec<Option<String>>>()?;
- let mut s = Utf8Chunked::new(&name, v).into_series();
+ pub fn new_str(name: String, val: Wrap<Utf8Chunked>, _strict: bool) -> Self {
+ let mut s = val.0.into_series();
s.rename(&name);
- Ok(RbSeries::new(s))
+ RbSeries::new(s)
}
pub fn estimated_size(&self) -> usize {
self.series.borrow().estimated_size()
}
@@ -197,20 +196,20 @@
pub fn rename(&self, name: String) {
self.series.borrow_mut().rename(&name);
}
- pub fn dtype(&self) -> String {
- self.series.borrow().dtype().to_string()
+ pub fn dtype(&self) -> Value {
+ Wrap(self.series.borrow().dtype().clone()).into()
}
- pub fn inner_dtype(&self) -> Option<String> {
+ pub fn inner_dtype(&self) -> Option<Value> {
self.series
.borrow()
.dtype()
.inner_dtype()
- .map(|dt| dt.to_string())
+ .map(|dt| Wrap(dt.clone()).into())
}
pub fn set_sorted(&self, reverse: bool) -> Self {
let mut out = self.series.borrow().clone();
if reverse {
@@ -632,7 +631,7 @@
Ok(s.into())
}
}
pub fn to_rbseries_collection(s: Vec<Series>) -> Vec<RbSeries> {
- s.into_iter().map(|v| RbSeries::new(v)).collect()
+ s.into_iter().map(RbSeries::new).collect()
}