Guest User

Untitled

a guest
Feb 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. prior_qtr_rev = Window(
  2. Lag('rev'),
  3. partition_by=F('company_id'),
  4. order_by=F('fiscal_end_date').asc()
  5. )
  6.  
  7. yoy = F('rev') / prior_qtr_rev - 1
  8.  
  9. companies = Financial.objects.filter(
  10. company__ticker='AAPL',
  11. ).annotate(
  12. rev_yoy=yoy,
  13. )
  14.  
  15. yoy = F('rev') / Case(When(prior_qtr_rev=0,
  16. then=0),
  17. default=prior_qtr_rev,
  18. output_field=FloatField()
  19. ) - 1
  20.  
  21. django.core.exceptions.FieldError:
  22. Cannot resolve keyword 'prior_qtr_rev' into field. Choices are:
Add Comment
Please, Sign In to add comment