polars-df 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -158,10 +158,16 @@ where
158
158
  {
159
159
  let skip = usize::from(first_value.is_some());
160
160
  if init_null_count == df.height() {
161
- ChunkedArray::full_null("apply", df.height())
161
+ ChunkedArray::full_null(PlSmallStr::from_static("map"), df.height())
162
162
  } else {
163
163
  let iter = apply_iter(df, lambda, init_null_count, skip);
164
- iterator_to_primitive(iter, init_null_count, first_value, "apply", df.height())
164
+ iterator_to_primitive(
165
+ iter,
166
+ init_null_count,
167
+ first_value,
168
+ PlSmallStr::from_static("map"),
169
+ df.height(),
170
+ )
165
171
  }
166
172
  }
167
173
 
@@ -174,10 +180,16 @@ pub fn apply_lambda_with_bool_out_type(
174
180
  ) -> ChunkedArray<BooleanType> {
175
181
  let skip = usize::from(first_value.is_some());
176
182
  if init_null_count == df.height() {
177
- ChunkedArray::full_null("apply", df.height())
183
+ ChunkedArray::full_null(PlSmallStr::from_static("map"), df.height())
178
184
  } else {
179
185
  let iter = apply_iter(df, lambda, init_null_count, skip);
180
- iterator_to_bool(iter, init_null_count, first_value, "apply", df.height())
186
+ iterator_to_bool(
187
+ iter,
188
+ init_null_count,
189
+ first_value,
190
+ PlSmallStr::from_static("map"),
191
+ df.height(),
192
+ )
181
193
  }
182
194
  }
183
195
 
@@ -190,10 +202,16 @@ pub fn apply_lambda_with_utf8_out_type(
190
202
  ) -> StringChunked {
191
203
  let skip = usize::from(first_value.is_some());
192
204
  if init_null_count == df.height() {
193
- ChunkedArray::full_null("apply", df.height())
205
+ ChunkedArray::full_null(PlSmallStr::from_static("map"), df.height())
194
206
  } else {
195
207
  let iter = apply_iter::<String>(df, lambda, init_null_count, skip);
196
- iterator_to_utf8(iter, init_null_count, first_value, "apply", df.height())
208
+ iterator_to_utf8(
209
+ iter,
210
+ init_null_count,
211
+ first_value,
212
+ PlSmallStr::from_static("map"),
213
+ df.height(),
214
+ )
197
215
  }
198
216
  }
199
217
 
@@ -207,7 +225,10 @@ pub fn apply_lambda_with_list_out_type(
207
225
  ) -> RbResult<ListChunked> {
208
226
  let skip = usize::from(first_value.is_some());
209
227
  if init_null_count == df.height() {
210
- Ok(ChunkedArray::full_null("apply", df.height()))
228
+ Ok(ChunkedArray::full_null(
229
+ PlSmallStr::from_static("map"),
230
+ df.height(),
231
+ ))
211
232
  } else {
212
233
  let mut iters = get_iters_skip(df, init_null_count + skip);
213
234
  let iter = ((init_null_count + skip)..df.height()).map(|_| {
@@ -229,7 +250,14 @@ pub fn apply_lambda_with_list_out_type(
229
250
  Err(e) => panic!("ruby function failed {}", e),
230
251
  }
231
252
  });
232
- iterator_to_list(dt, iter, init_null_count, first_value, "apply", df.height())
253
+ iterator_to_list(
254
+ dt,
255
+ iter,
256
+ init_null_count,
257
+ first_value,
258
+ PlSmallStr::from_static("map"),
259
+ df.height(),
260
+ )
233
261
  }
234
262
  }
235
263
 
@@ -28,7 +28,7 @@ fn iterator_to_struct(
28
28
  it: impl Iterator<Item = Option<Value>>,
29
29
  init_null_count: usize,
30
30
  first_value: AnyValue,
31
- name: &str,
31
+ name: PlSmallStr,
32
32
  capacity: usize,
33
33
  ) -> RbResult<RbSeries> {
34
34
  let (vals, flds) = match &first_value {
@@ -89,7 +89,7 @@ fn iterator_to_struct(
89
89
  items
90
90
  .par_iter()
91
91
  .zip(flds)
92
- .map(|(av, fld)| Series::new(fld.name(), av))
92
+ .map(|(av, fld)| Series::new(fld.name().clone(), av))
93
93
  .collect::<Vec<_>>()
94
94
  });
95
95
 
@@ -103,7 +103,7 @@ fn iterator_to_primitive<T>(
103
103
  it: impl Iterator<Item = Option<T::Native>>,
104
104
  init_null_count: usize,
105
105
  first_value: Option<T::Native>,
106
- name: &str,
106
+ name: PlSmallStr,
107
107
  capacity: usize,
108
108
  ) -> ChunkedArray<T>
109
109
  where
@@ -136,7 +136,7 @@ fn iterator_to_bool(
136
136
  it: impl Iterator<Item = Option<bool>>,
137
137
  init_null_count: usize,
138
138
  first_value: Option<bool>,
139
- name: &str,
139
+ name: PlSmallStr,
140
140
  capacity: usize,
141
141
  ) -> ChunkedArray<BooleanType> {
142
142
  // safety: we know the iterators len
@@ -166,7 +166,7 @@ fn iterator_to_object(
166
166
  it: impl Iterator<Item = Option<ObjectValue>>,
167
167
  init_null_count: usize,
168
168
  first_value: Option<ObjectValue>,
169
- name: &str,
169
+ name: PlSmallStr,
170
170
  capacity: usize,
171
171
  ) -> ObjectChunked<ObjectValue> {
172
172
  // safety: we know the iterators len
@@ -196,7 +196,7 @@ fn iterator_to_utf8(
196
196
  it: impl Iterator<Item = Option<String>>,
197
197
  init_null_count: usize,
198
198
  first_value: Option<&str>,
199
- name: &str,
199
+ name: PlSmallStr,
200
200
  capacity: usize,
201
201
  ) -> StringChunked {
202
202
  let first_value = first_value.map(|v| v.to_string());
@@ -229,7 +229,7 @@ fn iterator_to_list(
229
229
  it: impl Iterator<Item = Option<Series>>,
230
230
  init_null_count: usize,
231
231
  first_value: Option<&Series>,
232
- name: &str,
232
+ name: PlSmallStr,
233
233
  capacity: usize,
234
234
  ) -> RbResult<ListChunked> {
235
235
  let mut builder =
@@ -246,7 +246,7 @@ fn iterator_to_list(
246
246
  Some(s) => {
247
247
  if s.len() == 0 && s.dtype() != dt {
248
248
  builder
249
- .append_series(&Series::full_null("", 0, dt))
249
+ .append_series(&Series::full_null(PlSmallStr::EMPTY, 0, dt))
250
250
  .unwrap()
251
251
  } else {
252
252
  builder.append_series(&s).map_err(RbPolarsErr::from)?