Signature for a standard `from_dataframe` constructor function
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
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Đọc phần to-be-decided trong protocol/dataframe_protocol_summary.md, cuộc thảo luận trong issue #29 và nguyên mẫu Pandas được trình bày ở đây. So sánh các chữ ký from_dataframe được đề xuất và các tùy chọn liên quan, sau đó xem lại bản nháp bài đăng blog thông báo. Hoàn thành khi dự án ghi lại một chữ ký tiêu chuẩn đã được thống nhất và phạm vi được hỗ trợ của chữ ký đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
One of the "to be decided" items at https://github.com/data-apis/dataframe-api/blob/dataframe-interchange-protocol/protocol/dataframe_protocol_summary.md#to-be-decided is:
Should there be a standard from_dataframe constructor function? This isn't completely necessary, however it's expected that a full dataframe API standard will have such a function. The array API standard also has such a function, namely from_dlpack. Adding at least a recommendation on syntax for this function would make sense, e.g., from_dataframe(df, stream=None). Discussion at https://github.com/data-apis/dataframe-api/issues/29#issuecomment-685903651 is relevant.
In the announcement blog post draft I tentatively answered that with "yes", and added an example. The question is what the desired signature should be. The Pandas prototype currently has the most basic signature one can think of:
def from_dataframe(df : DataFrameObject) -> pd.DataFrame:
"""
Construct a pandas DataFrame from ``df`` if it supports ``__dataframe__``
"""
if isinstance(df, pd.DataFrame):
return df
if not hasattr(df, '__dataframe__'):
raise ValueError("`df` does not support __dataframe__")
return _from_dataframe(df.__dataframe__())
The above just takes any dataframe supporting the protocol, and turns the whole things in the "library-native" dataframe. Now of course, it's possible to add functionality to it, to extract only a subset of the data. Most obviously, named columns:
def from_dataframe(df : DataFrameObject, *, colnames : Optional[Iterable[str]]= None) -> pd.DataFrame:
Other things we may or may not want to support:
- columns by index
- get a subset of chunks
My personal feeling is:
- columns by index: maybe, and if we do then with a separate keyword like
col_indices=None - a subset of chunks: probably not. This is more advanced usage, and if one needs it it's likely one wants to get the object returned by
__dataframe__first, then inspect some metadata, and only then decide what chunks to get.
Thoughts?
- 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ự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
lidofinance/diffyscan#239 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: the dev-setup table and AGENTS.md name the reviewed_by guard that CI's Changelog job runsĐang mởarea: tools documentation good first issue ready for a contributor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
eyalgolan/statecraft-israel#873 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
GET rooms API returns 500 due to nonexistent Room.is_active attributeCó thể đã có người làm @Mars-60 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add cover art to song rowsĐang mởenhancement
Độ 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 5 ngày
-
Harmony OPeNDAP SubSetter (HOSS) Geographic production rssmif16d 7 XYZ_PROV
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
nasa/harmony-autotester#341 ·