`DataScan` and `col_summary_tbl()` don't treat NaN as missing on Polars, PyArrow and Ibis tables
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Start by tracing DataScan's column profiling and the statistics used by col_summary_tbl(); compare how the pandas, Polars, PyArrow, and Ibis backends identify missing float values. Use the reproduction in the issue to check n_missing, the other statistics, and sample values. Done means all backends report the pandas results, with NaN counted as missing and excluded from other statistics.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
When a float column holds NaN, DataScan (and so col_summary_tbl()) gives different results depending on the backend. On pandas, NaN is counted in n_missing and left out of the other statistics, as the docs describe for missing values. On Polars, PyArrow and Ibis tables, NaN isn't counted as missing and stays in the statistics: the mean, SD and P95 become NaN, the median and Q3 shift on Polars (it sorts NaN above every number), n_unique counts NaN and null as two separate values, and nan shows up in the sample values.
Minimal reproduction:
import polars as pl
import pointblank as pb
df = pl.DataFrame({"x": [1.0, 2.0, 3.0, 4.0, float("nan"), None]})
for tbl in (df, df.to_pandas(), df.to_arrow()):
(prof,) = pb.DataScan(tbl).profile.column_profiles
stats = {s.name: s.val for s in prof.statistics}
print({k: stats[k] for k in ("n_missing", "n_unique", "mean", "std", "median", "q_3", "p95")}, prof.sample_data)
Output (tidied):
polars {'n_missing': 1, 'n_unique': 6, 'mean': nan, 'std': nan, 'median': 3.0, 'q_3': 4.0, 'p95': nan} ['1.0', '2.0', '3.0', '4.0', 'nan']
pandas {'n_missing': 2, 'n_unique': 5, 'mean': 2.5, 'std': 1.291, 'median': 2.5, 'q_3': 3.25, 'p95': 3.85} ['1.0', '2.0', '3.0', '4.0']
pyarrow {'n_missing': 1, 'n_unique': 6, 'mean': nan, 'std': nan, 'median': 2.5, 'q_3': 3.25, 'p95': 3.85} ['1.0', '2.0', '3.0', '4.0', 'nan']
An Ibis table on DuckDB (ibis.memtable(df.to_arrow())) gives the same result as PyArrow, and a Polars LazyFrame the same as Polars.
Expected: the same profile on every backend, the one pandas gives. NaN counts as missing (n_missing is 2) and is left out of the other statistics, as the to_dict() docs say for a missing value ("The missing reading is counted in n_missing and left out of the other statistics"). This would also match how NaN is handled elsewhere in Pointblank, for example in missing_vals_tbl(), col_vals_null() and schema inference.
Actual: on Polars, PyArrow and Ibis tables, NaN is counted as a value. The NA column of col_summary_tbl() misses it, and Mean and SD are NaN (P95 too on Polars).
Environment: pointblank main (d82e523), Python 3.12.13, Polars 2.1.0, pandas 3.1.0, PyArrow 26.0.0, Ibis 12.0.0, DuckDB 1.5.6, Narwhals 2.28.0, macOS.
- Ngôn ngữ chính
- Python
- Star
- 506
- Fork
- 42
- Merge trung bình
- 5 giờ 46 phút
- Pull request đã merge (30 ngày)
- 89
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 posit-dev/pointblank
-
Type: ⁇ Question
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
posit-dev/pointblank#567 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
An equivalent of "multi-agent reports"Có thể làm lại được @rich-iannone đã nhận 456 ngày trước và không có pull request nào đang mở. Đang mởDifficulty: [3] Advanced Effort: [3] High Priority: [2] Medium Type: ★ Enhancement
posit-dev/pointblank#254 · 1 bình luận · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type: ★ Enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
posit-dev/pointblank#169 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type: ★ Enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
posit-dev/pointblank#92 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type: ★ Enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
posit-dev/pointblank#91 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của posit-dev/pointblank
Issue tương tự
-
soup prune-prompt exits 1 after writing its output on a file over 100,000 rows, and reports a capped row count otherwiseCó thể đã có người làm @abdulwaarith0 đã nhận hôm nay. Đang mởneeds-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
MakazhanAlpamys/Soup#3690 · 1 bình luận ·
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 78/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 78/100
-
bug data-types native-format
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
ClickHouse/clickhouse-connect#1320 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Public benchmark import end-to-end test fails when the test stack's worker runs the parity jobĐang mởaccepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
future-agi/future-agi#6392 ·
Maintainer thường phản hồi trong vòng 1 ngày