[ENH] Automatically convert non-string categorical data in attributes_arff_from_df

Đang mở
#1,489 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
52/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ệ
pandas, python
Lĩnh vực
data

Hướng nghiên cứu

Locate the Python entry point for attributes_arff_from_df and inspect how categorical columns currently reject non-string values. Exercise it with a pandas DataFrame whose categorical values are integers, then verify that the conversion succeeds and produces string nominals instead of raising the current ValueError.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Is your feature request related to a problem? Please describe.
Currently, attributes_arff_from_df raises a ValueError if a pandas DataFrame contains a categorical column with non-string values (e.g., integers [0, 1]). The user is forced to manually cast these to strings before passing the DataFrame.

Describe the solution you'd like
Instead of raising an error immediately, the function should attempt to automatically convert the categories to strings using .astype(str). This improves UX for users working with mixed-type or integer-encoded categorical data.

Describe alternatives you've considered
Keep raising the error, but improve the message. However, automatic conversion is more user-friendly as ARFF expects string nominals anyway.

Additional context
I have a fix implemented locally and can submit a PR.

Ngôn ngữ chính
Python
Star
361
Fork
296
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openml/openml-python

Tất cả issue của openml/openml-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.