feature request: make graph_objects also dataframe agnostic
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
説明
I was wondering, since narwhals was such a success in the plotly express api, whether the graph_objects api could get the same treatment. For the few trace types I tried (Scatter, Bar), arguments such as x, y, marker_color etc., accept tuple, list, numpy array, or pandas Series.
It would be great to be able to pass arrow or polars series as well, via narwhals, though I have no idea how feasible that would really be.
Desired outcome would be something like this:
"""
Fresh environment
>>> uv init
>>> uv add plotly polars
"""
import plotly.graph_objects as go
import polars as pl
df = pl.DataFrame({"x": [0, 1, 2, 3, 4], "y": [0, 1, 4, 9, 16]})
fig = go.Figure()
fig.add_trace(
go.Scatter(x=df["x"], y=df["y"]),
)
fig.show()
Currently one has to either transform to a list, pandas series, or if numpy is installed, there is some implicit transformation, which allows to pass polars series directly.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、提供された polars の例を graph_objects API を通じて再現し、Scatter と Bar を使った go.Figure.add_trace に重点を置きます。x、y、marker_color 引数が現在、リスト、NumPy 配列、pandas Series をどのように処理しているかを調査します。関連する graph_objects の trace 引数が、変換を必要とせず narwhals を通じて polars と Arrow の series を受け付ければ完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- data-visualization
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100