Skip to content

Commit 887c274

Browse files
committed
Sorting dataframe along div yield and then DGR 3%
1 parent 80f04d4 commit 887c274

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/divanalysis/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,11 @@ fn get_companies_data(companies: &[String], database: Option<String>) -> Result<
341341
.vstack(&df)
342342
.map_err(|_| "Unable to combine data frames")?;
343343

344+
// Lets sort it so most important is years of growth and within..
345+
// .. the same results we sort according to dividend yield..
346+
// .. and then lastly according the DGR 3Y
344347
let mut df = df
345-
.sort(["Years of consecutive Div growth"], true, false)
348+
.sort(["Years of consecutive Div growth", "Div Yield[%]","DGR 3Y[%]"], vec![true, true, true], false)
346349
.unwrap();
347350

348351
let mut file =
@@ -398,7 +401,7 @@ fn get_companies_data(companies: &[String], database: Option<String>) -> Result<
398401
.map_err(|_| "Unable to combine data frames")?;
399402

400403
let df = df
401-
.sort(["Years of consecutive Div growth"], true, false)
404+
.sort(["Years of consecutive Div growth", "Div Yield[%]", "DGR 3Y[%]"], vec![true, true, true], false)
402405
.unwrap();
403406

404407
println!("{df}");

0 commit comments

Comments
 (0)