Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Profiling a file with a high-cardinality geography column takes quadratic time in _build_flags

Closed Beginner friendly
#1,042 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript, pandas, python
Domain
data, performance

Research direction

Start with faircode/profiler.py _build_flags() and inspect the list membership check described in the issue; compare it with assets/profiler-engine.js buildFlags(). Read tests/test_profiler.py and add the suggested regression case with 50,000 distinct labels. Done when the lookup is efficient in both engines, the result still exposes a list, and the regression test completes within a few seconds.

Written by the indexing model from the issue text.

Description

bug help wanted

Where: faircode/profiler.py _build_flags() (line 455 onward: g["label"] in d["under_represented"] is a list membership test inside a loop over groups), assets/profiler-engine.js buildFlags(), tests/test_profiler.py.

Current gap: geography columns are exempt from max_dimension_groups, so a zip column with tens of thousands of values is profiled in full, and flag building tests membership in a list for every group. With 200,000 rows and about 90,000 zip codes profile() spent 19.5 of 21 seconds in _build_flags; 500,000 rows took 26 seconds in total (the web engine 10).

Repro:

>>> import numpy as np, pandas as pd, time; from faircode import profile
>>> n = 200_000
>>> df = pd.DataFrame({"sex": np.random.choice(["m", "f"], n), "zip": np.random.randint(10000, 99999, n).astype(str)})
>>> t = time.time(); profile(df); round(time.time() - t, 1)
~20.0        # about 0.4 s without the zip column

Suggested approach: make under_represented a set for the lookup (keep the list in the result), do the same in JS, and add a regression test with 50,000 distinct labels that finishes within a few seconds.

Dominant language
HTML
Stars
47
Forks
45
Avg merge
3h 24m
Merged PRs (30d)
72

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from yakew7/Fair-Code

All issues in yakew7/Fair-Code

Similar issues

More Data Engineering issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.