Skip to content

docs: Add time series analysis notebook - #2328

Merged
shuoweil merged 10 commits into
mainfrom
shuowei-time-series-bike
Dec 15, 2025
Merged

docs: Add time series analysis notebook#2328
shuoweil merged 10 commits into
mainfrom
shuowei-time-series-bike

Conversation

@shuoweil

@shuoweilshuoweil commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

Adds a new notebook, timeseries_analysis.ipynb, to provide a comprehensive walkthrough of time series forecasting with TimesFM and ARIMAPlus. The notebook covers data loading, preprocessing, model training, and visualization of results for both single and multiple time series.

Fixes #<466169940> 🦕

@shuoweilshuoweil self-assigned this Dec 12, 2025
@shuoweil
shuoweil requested review from a teamDecember 12, 2025 04:06
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@product-auto-labelproduct-auto-labelBot added size: l Pull request size is large. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Dec 12, 2025
Comment threadbigframes/ml/forecasting.py Outdated
# Auto-convert Date to datetime for hourly/per_minute frequency
if self.data_frequency in ["hourly", "per_minute"]:
timestamp_col = X.columns[0]
if "date" in X[timestamp_col].dtype.name:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-rhetorical question: What if the the column has dtype "datetime"? Is it necessary that we still cast that column as datetime, and warn that the column has "date" type?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error would not exist if column has a dtype "datetime". In this case, no cast/warning will exist.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, in that case the expression

"date" in X[timestamp_col].dtype.name

would still evaluate to True, right? Is that something we want?

@shuoweilshuoweilDec 12, 2025

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for suggestion. I believe Garrett has a fair point. Thus I revert the code change. Now this PR only include the notebook changes.

Comment threadbigframes/ml/forecasting.py Outdated
timestamp_col = X.columns[0]
if "date" in X[timestamp_col].dtype.name:
warnings.warn(
f"Converting Date column '{timestamp_col}' to datetime for "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems not make sense to convert and predict with hourly and minute data frequency to date granularity. We should just let it emit errors.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a fair point. I revert the code change and update notebook

@shuoweilshuoweil changed the title feat: Add time series analysis notebook and date conversiondocs: Add time series analysis notebookDec 12, 2025
@shuoweil
shuoweilforce-pushed the shuowei-time-series-bike branch from 3124cd3 to b1215caCompareDecember 12, 2025 23:18
@product-auto-labelproduct-auto-labelBot added size: xl Pull request size is extra large. and removed size: l Pull request size is large. labels Dec 12, 2025

@sycaisycai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@shuoweil
shuoweil merged commit 369f1c0 into mainDec 15, 2025
25 checks passed
@shuoweil
shuoweil deleted the shuowei-time-series-bike branch December 15, 2025 18:40
@ldetmerldetmer mentioned this pull request Jan 6, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigqueryIssues related to the googleapis/python-bigquery-dataframes API.size: xlPull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@shuoweil@GarrettWu@sycai