Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pola-rs
GitHub Repository: pola-rs/polars
Path: blob/main/crates/polars-python/src/interop/numpy/mod.rs
7892 views
1
macro_rules! with_match_physical_numpy_polars_type {(
2
$key_type:expr, | $_:tt $T:ident | $($body:tt)*
3
) => ({
4
macro_rules! __with_ty__ {( $_ $T:ident ) => ( $($body)* )}
5
use polars_core::datatypes::DataType as D;
6
match $key_type {
7
#[cfg(feature = "dtype-i8")]
8
D::Int8 => __with_ty__! { Int8Type },
9
#[cfg(feature = "dtype-i16")]
10
D::Int16 => __with_ty__! { Int16Type },
11
D::Int32 => __with_ty__! { Int32Type },
12
D::Int64 => __with_ty__! { Int64Type },
13
#[cfg(feature = "dtype-u8")]
14
D::UInt8 => __with_ty__! { UInt8Type },
15
#[cfg(feature = "dtype-u16")]
16
D::UInt16 => __with_ty__! { UInt16Type },
17
D::UInt32 => __with_ty__! { UInt32Type },
18
D::UInt64 => __with_ty__! { UInt64Type },
19
#[cfg(feature = "dtype-f16")]
20
D::Float16 => __with_ty__! { Float16Type },
21
D::Float32 => __with_ty__! { Float32Type },
22
D::Float64 => __with_ty__! { Float64Type },
23
dt => panic!("not implemented for dtype {:?}", dt),
24
}
25
})}
26
27
pub mod to_numpy_df;
28
pub mod to_numpy_series;
29
mod utils;
30
31