mirror of
https://github.com/nushell/nushell.git
synced 2024-11-21 16:03:19 +01:00
Add support for converting polars decimal values to nushell values (#14343)
Adds support for converting from polars decimal type to nushell values. This fix works by first converting a polars decimal series to an f64 series, then converting to Value::Float Co-authored-by: Jack Wright <jack.wright@nike.com>
This commit is contained in:
parent
215ca6c5ca
commit
9d0f69ac50
@ -1201,6 +1201,18 @@ fn series_to_values(
|
|||||||
|
|
||||||
Ok(values)
|
Ok(values)
|
||||||
}
|
}
|
||||||
|
DataType::Decimal(_precision, _scale) => {
|
||||||
|
let casted = series
|
||||||
|
.cast(&DataType::Float64)
|
||||||
|
.map_err(|e| ShellError::GenericError {
|
||||||
|
error: "Errors casting decimal column to float".into(),
|
||||||
|
msg: "".into(),
|
||||||
|
span: None,
|
||||||
|
help: Some(e.to_string()),
|
||||||
|
inner: vec![],
|
||||||
|
})?;
|
||||||
|
series_to_values(&casted, maybe_from_row, maybe_size, span)
|
||||||
|
}
|
||||||
e => Err(ShellError::GenericError {
|
e => Err(ShellError::GenericError {
|
||||||
error: "Error creating Dataframe".into(),
|
error: "Error creating Dataframe".into(),
|
||||||
msg: "".to_string(),
|
msg: "".to_string(),
|
||||||
|
Loading…
Reference in New Issue
Block a user