Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
dataframe in datafusion - Rust
[go: Go Back, main page]

Macro dataframe

Source
macro_rules! dataframe {
    () => { ... };
    ($($name:expr => $data:expr),+ $(,)?) => { ... };
}
Expand description

Macro for creating DataFrame.

ยงExample

use datafusion::prelude::dataframe;
let df = dataframe!(
   "id" => [1, 2, 3],
   "name" => ["foo", "bar", "baz"]
 )?;
df.show().await?;
// +----+------+,
// | id | name |,
// +----+------+,
// | 1  | foo  |,
// | 2  | bar  |,
// | 3  | baz  |,
// +----+------+,
let df_empty = dataframe!()?; // empty DataFrame
assert_eq!(df_empty.schema().fields().len(), 0);
assert_eq!(df_empty.count().await?, 0);