1

I am trying to print a dataframe in rust. This is my code:

use polars_core::prelude::*;
use polars_io::prelude::*;

fn main() {
    let test_df = example();
    println!("{:?}", test_df);
}

fn example() -> DataFrame {
            CsvReadOptions::default()
            .with_has_header(true)
            .try_into_reader_with_file_path(Some("C://Rust_WS//test_dataframe//test.csv".into()))
            .unwrap()
            .finish()
            .unwrap()
}

Output of that 'cargo run' is:

PS C:\Rust_WS\test_dataframe> cargo run
   Compiling test_dataframe v0.1.0 (C:\Rust_WS\test_dataframe)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.16s
     Running `target\debug\test_dataframe.exe`
shape: (5, 3)
to see more, compile with the 'fmt' or 'fmt_no_tty' feature
PS C:\Rust_WS\test_dataframe> 

How to print the contents of the data frame?

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.