Interchange protocol use case: getting certain columns as numpy array
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Bắt đầu với trường hợp sử dụng matplotlib plot("x", "y", data=obj) và dataframe interchange API, đặc biệt là dataframe(), get_column_by_name() và get_buffers(). Xác định xem việc chuyển đổi các cột đã chọn sang NumPy có nằm trong phạm vi hay không và API nào sẽ bao quát nhiều buffer; được xem là hoàn thành khi đã thống nhất về một trường hợp sử dụng và định hướng API.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I think it's useful to think through concrete use cases on how the interchange protocol could be used, to see if it covers those use cases / the desired APIs are available.
One example use case could be matplotlib's plot("x", "y", data=obj), where matplotlib already supports getting the x and y column of any "indexable" object. Currently they require obj["x"] to give the desired data, but so in theory this support could be extended to any object that supports the dataframe interchange protocol. But at the same time, matplotlib currently also needs those data (AFAIK) as numpy arrays because the low-level plotting code is implemented in such a way.
With the current API, matplotlib could do something like:
df = obj.__dataframe__()
x_values = some_utility_func(df.get_column_by_name("x").get_buffers())
where some_utility_func can convert the dict of Buffer objects to a numpy array (once numpy supports dlpack, converting the Buffer objects to numpy will become easy, but the function will then still need to handle potentially multiple buffers returned from get_buffers()).
That doesn't seem ideal: 1) writing the some_utility_func to do the conversion to numpy is non-trivial to implement for all different cases, 2) should an end-user library have to go down to the Buffer objects?
This isn't a pure interchange from one dataframe library to another, so we could also say that this use case is out-of-scope at the moment. But on the other hand, it seems a typical use case example, and could in theory already be supported right now (it only needs the "dataframe api" to get a column, which is one of the few things we already provide).
(disclaimer: I am not a matplotlib developer, I also don't know if they for example have efforts to add support for generic array-likes (but it's nonetheless a typical example use case, I think))
- Ngôn ngữ chính
- Python
- Star
- 106
- Fork
- 22
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của data-apis/dataframe-api
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
data-apis/dataframe-api#363 · 1 bình luận · 8 reaction ·
-
Row ordering design choiceĐang mởAPI design
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
data-apis/dataframe-api#356 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
data-apis/dataframe-api#355 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
data-apis/dataframe-api#352 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
data-apis/dataframe-api#351 ·
Tất cả issue của data-apis/dataframe-api
Issue tương tự
-
python triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
microsoft/semantic-kernel#14590 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
pinterest/pymemcache#662 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
gnocchixyz/gnocchi#1527 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
tenstorrent/tt-model-manager#181 ·
Maintainer thường phản hồi trong vòng 1 ngày