original_docstring: 
      Calculates outcome averages with both simple and weighted averages,
      choosing the higher of the two
      :param outcome_results:
      :return: DataFrame of outcome_averages with max of two averages
      
docstring: Calculates outcome averages with both simple and weighted averages,
  choosing the higher of the two
docstring_tokens: Calculates outcome averages with both simple and weighted averages choosing the higher of the two
code: def calc_outcome_avgs(outcome_results):
      """
      Calculates outcome averages with both simple and weighted averages,
      choosing the higher of the two
      :param outcome_results:
      :return: DataFrame of outcome_averages with max of two averages
      """
  
      group_cols = ["links.user", "outcome_id", "course_id"]
  
      # Calculate the average without dropping the low score
      no_drop_avg = (
          outcome_results.groupby(group_cols)
          .agg(no_drop_score=("score", "mean"))
          .reset_index()
      )
  
      # Calculate the average without dropping the low score
      outcome_results_drop_min = outcome_results[outcome_results["rank"] != 1.0]
      drop_avg = (
          outcome_results_drop_min.groupby(group_cols)
          .agg(drop_score=("score", "mean"))
          .reset_index()
      )
  
      # Merge them together
      outcome_averages = pd.merge(no_drop_avg, drop_avg, on=group_cols)
  
      # Pick the greater average and note if a score was dropped
      outcome_averages["outcome_avg"] = (
          outcome_averages[["no_drop_score", "drop_score"]].max(axis=1).round(2)
      )
      outcome_averages["drop_min"] = np.where(
          outcome_averages["no_drop_score"] < outcome_averages["drop_score"], True, False
      )
  
      return outcome_averages
code_tokens: def calc_outcome_avgs ( outcome_results ) : group_cols = [ "links.user" , "outcome_id" , "course_id" ] no_drop_avg = ( outcome_results . groupby ( group_cols ) . agg ( no_drop_score = ( "score" , "mean" ) ) . reset_index ( ) ) outcome_results_drop_min = outcome_results [ outcome_results [ "rank" ] != 1.0 ] drop_avg = ( outcome_results_drop_min . groupby ( group_cols ) . agg ( drop_score = ( "score" , "mean" ) ) . reset_index ( ) ) outcome_averages = pd . merge ( no_drop_avg , drop_avg , on = group_cols ) outcome_averages [ "outcome_avg" ] = ( outcome_averages [ [ "no_drop_score" , "drop_score" ] ] . max ( axis = 1 ) . round ( 2 ) ) outcome_averages [ "drop_min" ] = np . where ( outcome_averages [ "no_drop_score" ] < outcome_averages [ "drop_score" ] , True , False ) return outcome_averages
short_docstring: Calculates outcome averages with both simple and weighted averages,
  choosing the higher of the two
short_docstring_tokens: Calculates outcome averages with both simple and weighted averages choosing the higher of the two
comment: """
      Calculates outcome averages with both simple and weighted averages,
      choosing the higher of the two
      :param outcome_results:
      :return: DataFrame of outcome_averages with max of two averages
      """$SEP$# Calculate the average without dropping the low score$SEP$# Calculate the average without dropping the low score$SEP$# Merge them together$SEP$# Pick the greater average and note if a score was dropped