`px.timeline` with a Daylight Savings Time scenario - missing/extra hour
オープン
まだ誰も着手していません。
bug
P3
sev-3
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
Problem:
When using px.timeline on a range where a Daylight Savings Time switch occurs & time zones are in the timestamps, I observe an unexpectedly shorter/longer duration of the bar.
Example A - March - missing an hour
import pandas as pd
import plotly.express as px
df = pd.DataFrame(dict(
x_start=[
pd.Timestamp("2024-03-09", tz="US/Pacific"),
pd.Timestamp("2024-03-10", tz="US/Pacific"),
pd.Timestamp("2024-03-11", tz="US/Pacific"),
],
x_end=[
pd.Timestamp("2024-03-10", tz="US/Pacific"),
pd.Timestamp("2024-03-11", tz="US/Pacific"),
pd.Timestamp("2024-03-12", tz="US/Pacific"),
],
y=[1, 1, 1],
))
px.timeline(df, x_start="x_start", x_end="x_end", y="y")
As you can see, for the DST day (March 10, 2024), the end date is unexpectedly 1 hour early, unlike the other days.
Example B - November - extra hour
import pandas as pd
import plotly.express as px
df = pd.DataFrame(dict(
x_start=[
pd.Timestamp("2023-11-05", tz="US/Pacific"),
],
x_end=[
pd.Timestamp("2023-11-06", tz="US/Pacific"),
],
y=[1],
))
px.timeline(df, x_start="x_start", x_end="x_end", y="y")
In this example, 1 hour is unexpectedly added to the end.
Testing environment:
- Google Colab (also experienced on VS Code & html)
- Latest version of plotly (5.22.0).
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue にある pandas と px.timeline の両方の例を再現し、3月と11月の DST の切り替えを対象にします。px.timeline のエントリポイントから、タイムゾーン対応のタイムスタンプの処理を追跡し、両方のケースに対するリグレッションテストを追加します。各バーが意図したローカルの暦上の間隔を、1時間の欠落や余分な時間なしにカバーすれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- pandas, python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100