Polars timezone not respected in graph_objects.scatter
オープン
まだ誰も着手していません。
bug
P2
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
latest version of plotly // python 3.12
from datetime import datetime, timedelta
from zoneinfo import ZoneInfo
import pandas as pd
import polars as pl
daterange = [datetime(2023, 1, 1, tzinfo=ZoneInfo("Australia/Brisbane")) + timedelta(hours=i) for i in range(48)]
df_1 = pl.DataFrame(
{
"timestamp": daterange,
"line1": [0.1] * 24 + [0.2] * 24,
}
)
df_2 = pl.DataFrame(
{
"timestamp": daterange,
"line2": [0.0] * 24 + [0.4] * 24,
}
)
fig = px.line(df_1, x="timestamp", y="line1")
fig.add_trace(
go.Scatter(
x=df_2["timestamp"],
y=df_2["line2"],
name="line2",
)
)
fig.show()
"line1" (using px.line )renders correctly with local time on the X-axis. But "line2" (using go.Scatter) gets converted to UTC.
This goes away if df_2 uses pandas or I pass in df_2['timestamp'].to_list() instead.
Probably related to https://github.com/plotly/plotly.py/issues/5166 - is this just because polars isn't supported, but since we've not got type hints in plotly my IDE wasn't complaining?
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された Python 再現コードから始め、x が Polars timestamp Series の場合と、リストまたは pandas データの場合で px.line と go.Scatter を比較します。go.Scatter が使用する変換経路を追跡し、タイムゾーン情報がどのように扱われるかを確認します。Polars Series がローカルタイムゾーンを一貫して保持し、再現コードが両方のトレースを一致する時刻値で描画すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- pandas, python
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100