diff --git a/docs/aggregate.md b/docs/aggregate.md index 96da43e..f5450a5 100644 --- a/docs/aggregate.md +++ b/docs/aggregate.md @@ -46,7 +46,7 @@ fn vertical_weighted_mean(inputs: &[Series]) -> PolarsResult { } }); let result = numerator / denominator; - Ok(Series::new("", vec![result])) + Ok(Series::new(PlSmallStr::EMPTY, vec![result])) } ``` diff --git a/docs/arrays.md b/docs/arrays.md index 796434a..e644f1e 100644 --- a/docs/arrays.md +++ b/docs/arrays.md @@ -76,7 +76,7 @@ And we can finally move to the actual plugin code: // #[polars_expr(output_type=Array)] pub fn point_2d_output(_: &[Field]) -> PolarsResult { Ok(Field::new( - "point_2d", + PlSmallStr::from_static("point_2d"), DataType::Array(Box::new(DataType::Float64), 2), )) } diff --git a/docs/cum_sum.md b/docs/cum_sum.md index 6af65be..b704e04 100644 --- a/docs/cum_sum.md +++ b/docs/cum_sum.md @@ -50,7 +50,6 @@ fn cum_sum(inputs: &[Series]) -> PolarsResult { } }) .collect_trusted(); - let out: Int64Chunked = out.with_name(ca.name()); Ok(out.into_series()) } ``` diff --git a/docs/life_pt1.md b/docs/life_pt1.md index 5b9de0a..0aa9697 100644 --- a/docs/life_pt1.md +++ b/docs/life_pt1.md @@ -267,7 +267,7 @@ fn life_step(inputs: &[Series]) -> PolarsResult { let len = lf.len(); - let mut out: Int64Chunked = mid + let out: Int64Chunked = mid .iter() .enumerate() .map(|(idx, val)| { @@ -297,7 +297,6 @@ fn life_step(inputs: &[Series]) -> PolarsResult { }) }) .collect_trusted(); - out.rename(ca_curr.name()); Ok(out.into_series()) } ``` diff --git a/docs/lists.md b/docs/lists.md index 3c098f9..5bc403d 100644 --- a/docs/lists.md +++ b/docs/lists.md @@ -72,7 +72,7 @@ where (Some(lhs), Some(rhs)) => f(&lhs, &rhs), _ => None, }) - .collect_ca(lhs.name()) + .collect_ca(PlSmallStr::EMPTY) } } ``` diff --git a/docs/lists_in_lists_out.md b/docs/lists_in_lists_out.md index 40771ba..f0c43df 100644 --- a/docs/lists_in_lists_out.md +++ b/docs/lists_in_lists_out.md @@ -36,8 +36,8 @@ a function to each element of a List Series. In this case, we just want to find elements, so we'll do: ```rust -fn list_idx_dtype(input_fields: &[Field]) -> PolarsResult { - let field = Field::new(input_fields[0].name(), DataType::List(Box::new(IDX_DTYPE))); +fn list_idx_dtype(_input_fields: &[Field]) -> PolarsResult { + let field = Field::new(PlSmallStr::EMPTY, DataType::List(Box::new(IDX_DTYPE))); Ok(field.clone()) } @@ -57,7 +57,7 @@ fn non_zero_indices(inputs: &[Series]) -> PolarsResult { .enumerate() .filter(|(_idx, opt_val)| opt_val != &Some(0)) .map(|(idx, _opt_val)| Some(idx as IdxSize)) - .collect_ca(""); + .collect_ca(PlSmallStr::EMPTY); out.into_series() }); Ok(out.into_series()) diff --git a/docs/struct.md b/docs/struct.md index 5066dc4..e1458ce 100644 --- a/docs/struct.md +++ b/docs/struct.md @@ -34,18 +34,17 @@ Then, we need to get the schema right. ```Rust fn shifted_struct(input_fields: &[Field]) -> PolarsResult { let field = &input_fields[0]; - match field.data_type() { + match field.dtype() { DataType::Struct(fields) => { let mut field_0 = fields[0].clone(); - let name = field_0.name().clone(); field_0.set_name(fields[fields.len() - 1].name().clone()); let mut fields = fields[1..] .iter() .zip(fields[0..fields.len() - 1].iter()) - .map(|(fld, name)| Field::new(name.name(), fld.data_type().clone())) + .map(|(fld, name)| Field::new(name.name().clone(), fld.dtype().clone())) .collect::>(); fields.push(field_0); - Ok(Field::new(&name, DataType::Struct(fields))) + Ok(Field::new(PlSmallStr::EMPTY, DataType::Struct(fields))) } _ => unreachable!(), } @@ -68,18 +67,18 @@ fn shift_struct(inputs: &[Series]) -> PolarsResult { return Ok(inputs[0].clone()); } let mut field_0 = fields[0].clone(); - field_0.rename(fields[fields.len() - 1].name()); + field_0.rename(fields[fields.len() - 1].name()).clone(); let mut fields = fields[1..] .iter() .zip(fields[..fields.len() - 1].iter()) .map(|(s, name)| { let mut s = s.clone(); - s.rename(name.name()); + s.rename(name.name().clone()); s }) .collect::>(); fields.push(field_0); - StructChunked::from_series(struct_.name(), &fields).map(|ca| ca.into_series()) + StructChunked::from_series(PlSmallStr::EMPTY, &fields).map(|ca| ca.into_series()) } ``` diff --git a/docs/vec_of_option.md b/docs/vec_of_option.md index 5962742..df60ab9 100644 --- a/docs/vec_of_option.md +++ b/docs/vec_of_option.md @@ -96,7 +96,7 @@ where out.into(), Some(validity.into()), ); - ChunkedArray::with_chunk(chunked_arr.name(), array) + ChunkedArray::with_chunk(PlSmallStr::EMPTY, array) } else { ChunkedArray::from_vec(chunked_arr.name(), out) } @@ -164,7 +164,7 @@ if first != 0 || last != chunked_arr.len() { out.into(), Some(validity.into()), ); - ChunkedArray::with_chunk(chunked_arr.name(), array) + ChunkedArray::with_chunk(PlSmallStr::EMPTY, array) } else { ChunkedArray::from_vec(chunked_arr.name(), out) }