john-bodley opened a new pull request, #20326:
URL: https://github.com/apache/superset/pull/20326

   <!---
   Please write the PR title following the conventions at 
https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   
   The `fbprophet` packages uses 
[`pandas.date_range`](https://pandas.pydata.org/docs/reference/api/pandas.date_range.html)
 per 
[here](https://github.com/facebook/prophet/blob/10310ceb2da05837a198db6714d658a1e0a32478/python/prophet/forecaster.py#L1567-L1570)
 for defining the forecast window where the frequency is defined via an [offset 
alias](https://pandas.pydata.org/docs/user_guide/timeseries.html#timeseries-offset-aliases).
   
   Previously the mapping was wrong, i.e., [these 
weeks](https://github.com/apache/superset/blob/master/superset/db_engine_specs/base.py#L112-L115)
 which use different days of the weeks as anchors (alongside the direction of 
the anchor, i.e., starting vs. ending) previously all mapped to `W` which is 
the same as `W-SUN` and thus weekly forecasts did not adhere to the correct 
periodicity defined in the fitted data.
   
   The fix is merely to use the [anchored 
offsets](https://pandas.pydata.org/docs/user_guide/timeseries.html#anchored-offsets).
 Pandas doesn't do a great job in specifying whether it's the week starting or 
week ending on Sunday say for `W-SUN`, however it's irrelevant for our needs, 
i.e., for both "Week starting Sunday" and "Week ending Sunday" the data 
provided by Superset to `fbprohet` has been bucketed appropriately and anchored 
on a Sunday and thus all `fbprohet` needs to know is Sundays (`W-SUN`) defines 
the weekly periodicity.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   
   Tested locally.
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to