quick_start.md (prophet-1.1) | : | quick_start.md (prophet-1.1.1) | ||
---|---|---|---|---|
skipping to change at line 31 | skipping to change at line 31 | |||
First we'll import the data: | First we'll import the data: | |||
```python | ```python | |||
# Python | # Python | |||
import pandas as pd | import pandas as pd | |||
from prophet import Prophet | from prophet import Prophet | |||
``` | ``` | |||
```python | ```python | |||
# Python | # Python | |||
df = pd.read_csv('../examples/example_wp_log_peyton_manning.csv') | df = pd.read_csv('https://raw.githubusercontent.com/facebook/prophet/main/exampl es/example_wp_log_peyton_manning.csv') | |||
df.head() | df.head() | |||
``` | ``` | |||
<div> | <div> | |||
<style scoped> | <style scoped> | |||
.dataframe tbody tr th:only-of-type { | .dataframe tbody tr th:only-of-type { | |||
vertical-align: middle; | vertical-align: middle; | |||
} | } | |||
.dataframe tbody tr th { | .dataframe tbody tr th { | |||
skipping to change at line 270 | skipping to change at line 270 | |||
library(prophet) | library(prophet) | |||
``` | ``` | |||
R[write to console]: Loading required package: Rcpp | R[write to console]: Loading required package: Rcpp | |||
R[write to console]: Loading required package: rlang | R[write to console]: Loading required package: rlang | |||
First we read in the data and create the outcome variable. As in the Python API, this is a dataframe with columns `ds` and `y`, containing the date and numeric value respectively. The ds column should be YYYY-MM-DD for a date, or YYYY-MM-DD HH:MM:SS for a timestamp. As above, we use here the log number of views to Peyt on Manning's Wikipedia page, available [here](https://github.com/facebook/prophe t/blob/main/examples/example_wp_log_peyton_manning.csv). | First we read in the data and create the outcome variable. As in the Python API, this is a dataframe with columns `ds` and `y`, containing the date and numeric value respectively. The ds column should be YYYY-MM-DD for a date, or YYYY-MM-DD HH:MM:SS for a timestamp. As above, we use here the log number of views to Peyt on Manning's Wikipedia page, available [here](https://github.com/facebook/prophe t/blob/main/examples/example_wp_log_peyton_manning.csv). | |||
```R | ```R | |||
# R | # R | |||
df <- read.csv('../examples/example_wp_log_peyton_manning.csv') | df <- read.csv('https://raw.githubusercontent.com/facebook/prophet/main/examples /example_wp_log_peyton_manning.csv') | |||
``` | ``` | |||
We call the `prophet` function to fit the model. The first argument is the hist orical dataframe. Additional arguments control how Prophet fits the data and ar e described in later pages of this documentation. | We call the `prophet` function to fit the model. The first argument is the hist orical dataframe. Additional arguments control how Prophet fits the data and ar e described in later pages of this documentation. | |||
```R | ```R | |||
# R | # R | |||
m <- prophet(df) | m <- prophet(df) | |||
``` | ``` | |||
Predictions are made on a dataframe with a column `ds` containing the dates for which predictions are to be made. The `make_future_dataframe` function takes the model object and a number of periods to forecast and produces a suitable datafr ame. By default it will also include the historical dates so we can evaluate in- sample fit. | Predictions are made on a dataframe with a column `ds` containing the dates for which predictions are to be made. The `make_future_dataframe` function takes the model object and a number of periods to forecast and produces a suitable datafr ame. By default it will also include the historical dates so we can evaluate in- sample fit. | |||
```R | ```R | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |