Plotting DataFrame with timedelta64 (y-axis)
未關閉
還沒有人認領這個 Issue。
feature
P3
- 主要語言
- Python
- 星號
- 18.8k
- 分支
- 2.8k
- 平均合併
- 16 小時 26 分鐘
- 30 天內合併 PR
- 21
描述
Similar to #799 but on y-axis and https://github.com/pandas-dev/pandas/issues/16953
import pandas as pd
from pandas.compat import StringIO
import plotly
import plotly.graph_objs as go
dat = """c1,c2,c3
1000,2000,1500
9000,8000,1600"""
df = pd.read_csv(StringIO(dat))
df = df.apply(lambda x: pd.to_timedelta(x, unit='ms'))
print(df)
print(df.dtypes)
print(df.index)
trace1 = go.Bar(
x=df.index,
y=df.c1,
name='c1'
)
trace2 = go.Bar(
x=df.index,
y=df.c2,
name='c2'
)
trace3 = go.Bar(
x=df.index,
y=df.c3,
name='c3'
)
data = [trace1, trace2, trace3]
layout = go.Layout(
barmode='group'
)
plotly.offline.plot({
"data": data,
"layout": layout
})
displays

y-axis values are not correctly displayed
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先執行提供的 Python 重現程式,並將 timedelta64 y 軸值與轉譯後的圖表進行比較。追蹤 pandas timedelta 值如何傳入 Plotly 的 bar trace,並將完成標準定義為此範例中的 y 軸值能正確顯示。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- pandas, plotly, python
- 領域
- data-visualization
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 40/100