Skip to main content

ndarray_shape_schema

Function ndarray_shape_schema 

Source
pub fn ndarray_shape_schema(shape: &[usize], dtype_name: &str) -> Arc<Schema> 
Expand description

Create an Arrow schema that encodes ndarray shape information

This is useful for roundtrip conversions where the original shape must be preserved (e.g., reshaping a 3D array through Arrow).

§Arguments

  • shape - The ndarray shape
  • dtype_name - Human-readable type name

§Examples

let schema = ndarray_shape_schema(&[10, 20, 30], "f64");
let meta = schema.metadata();
assert_eq!(meta.get("ndarray.shape"), Some(&"10,20,30".to_string()));
assert_eq!(meta.get("ndarray.ndim"), Some(&"3".to_string()));
assert_eq!(meta.get("ndarray.dtype"), Some(&"f64".to_string()));