Example #1
0
 def test_between_bottom_total(self, holidays, bookings, usa, topn_dg_cols):
     between_bottom_1_3600_by_profit = TopNClause(
         usa, (1, 3600), by=bookings["Profit"], ascending=True, session=holidays
     )
     assert between_bottom_1_3600_by_profit.count() == 3600
     verify_topn_values(
         between_bottom_1_3600_by_profit,
         3600,
         topn_dg_cols,
         4000,
         "Profit",
         16,
         "Cost",
         87.11,
     )
Example #2
0
 def test_between_top_percentage(self, holidays, bookings, usa, topn_dg_cols):
     between_top_6_28_10_35_pct_by_profit = TopNClause(
         usa, percent=(6.28, 10.35), by=bookings["Profit"], session=holidays
     )
     assert between_top_6_28_10_35_pct_by_profit.count() == 22867
     verify_topn_values(
         between_top_6_28_10_35_pct_by_profit,
         22867,
         topn_dg_cols,
         25000,
         "Profit",
         0,
         "Booking URN",
         "10641231",
     )
Example #3
0
 def test_between_top_total(self, holidays, bookings, usa, topn_dg_cols):
     between_top_50_100_by_profit = TopNClause(
         usa, (50, 100), by=bookings["Profit"], session=holidays
     )
     assert between_top_50_100_by_profit.count() == 51
     verify_topn_values(
         between_top_50_100_by_profit,
         51,
         topn_dg_cols,
         1000,
         "Profit",
         33,
         "Profit",
         2733.14,
     )
Example #4
0
 def test_bottom_percentage(self, holidays, bookings, usa, topn_dg_cols):
     bottom_0_827_pct_by_cost = TopNClause(
         usa, percent=0.827, by=bookings["Cost"], ascending=True, session=holidays
     )
     assert bottom_0_827_pct_by_cost.count() == 4646
     verify_topn_values(
         bottom_0_827_pct_by_cost,
         4646,
         topn_dg_cols,
         50000,
         "Cost",
         22,
         "Booking URN",
         "11701935",
     )
Example #5
0
 def test_bottom_total(self, holidays, bookings, usa, topn_dg_cols):
     bottom_4278_by_cost = TopNClause(
         usa, 4278, by=bookings["Cost"], ascending=True, session=holidays
     )
     assert bottom_4278_by_cost.count() == 4278
     verify_topn_values(
         bottom_4278_by_cost,
         4278,
         topn_dg_cols,
         4300,
         "Cost",
         13,
         "Booking URN",
         "10583471",
     )
Example #6
0
 def test_top_percentage(self, holidays, bookings, usa, topn_dg_cols):
     top_1_65_pct_by_cost = TopNClause(
         usa, percent=1.65, by=bookings["Cost"], session=holidays
     )
     assert top_1_65_pct_by_cost.count() == 9270
     verify_topn_values(
         top_1_65_pct_by_cost,
         9270,
         topn_dg_cols,
         10000,
         "Cost",
         17,
         "Profit",
         4309.71,
     )
Example #7
0
 def test_between_bottom_percentage(self, holidays, bookings, usa, topn_dg_cols):
     between_bottom_24_63_25_86_pct_by_profit = TopNClause(
         usa,
         percent=(24.63, 25.86),
         by=bookings["Profit"],
         ascending=True,
         session=holidays,
     )
     assert between_bottom_24_63_25_86_pct_by_profit.count() == 6911
     verify_topn_values(
         between_bottom_24_63_25_86_pct_by_profit,
         6911,
         topn_dg_cols,
         7000,
         "Profit",
         8,
         "Cost",
         300.51,
     )
Example #8
0
 def test_top_total(self, holidays, bookings, usa, topn_dg_cols):
     top_637_by_cost = TopNClause(usa, 637, by=bookings["Cost"], session=holidays)
     assert top_637_by_cost.count() == 637
     verify_topn_values(
         top_637_by_cost, 637, topn_dg_cols, 750, "Cost", 9, "Cost", 28400.18
     )