Skip to content

Instantly share code, notes, and snippets.

@Joshuaek
Created March 4, 2020 21:47
Show Gist options
  • Save Joshuaek/b122256f61a65cc985cc9b8ab5061d85 to your computer and use it in GitHub Desktop.
Save Joshuaek/b122256f61a65cc985cc9b8ab5061d85 to your computer and use it in GitHub Desktop.
def result(self):
# Ensure all calculations are done and return the dataframe
# First, sum all licence columns to get the total earned in that month from all live contracts
self.df['forecast_licences'] = self.df[[c.contract_name for c in self.contracts]].sum(axis=1)
# Secondly, calculate a cumulative total licence sales
self.df['total_sales'] = self.df.forecast_licences.cumsum()
return self.df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment