Created
June 28, 2021 14:46
-
-
Save Steboss89/da6039df64759236bad99c4786b4ab7c to your computer and use it in GitHub Desktop.
Get shape and info from a dataframe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn deal_with_shape<P: AsRef<Path>>(path: P) -> () { | |
/* Example function to retrieve shape info from a dataframe */ | |
let df = read_csv(&path).unwrap(); | |
// shape | |
// reming {:#?} otherwise error ^^^^^ `(usize, usize)` cannot be formatted with the default formatter | |
let shape = df.shape(); | |
println!("{:#?}", shape); | |
// schema | |
println!("{:#?}", df.schema()); | |
// dtypes | |
println!("{:#?}", df.dtypes()); | |
// or width and height | |
let width = df.width(); | |
println!("{}", width); | |
let height = df.height(); | |
println!("{}", height); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment