Skip to content

Add pandas data loader with schema inference - #2

Merged
tmgsr02 merged 2 commits into
masterfrom
codex/create-dataloader-class-and-utilities
Oct 24, 2025
Merged

tmgsr02 merged 2 commits into
masterfrom
codex/create-dataloader-class-and-utilities

Conversation

@tmgsr02

@tmgsr02 tmgsr02 commented Oct 24, 2025

Copy link
Copy Markdown
Owner

Summary

  • add a DataLoader class that wraps pandas CSV and Excel readers with schema inference and chunked iteration
  • expose column metadata via new macrobase_py package exports and conversions to typed DataFrames
  • cover ingestion paths, schema detection heuristics, and error conditions with pytest-based unit tests

Testing

  • pytest

https://chatgpt.com/codex/tasks/task_e_68fade0e60108320a333a43a54539ec5

@tmgsr02
tmgsr02 merged commit a0d88d5 into master Oct 24, 2025
0 of 8 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +177 to +182
datetime_coerced = pd.to_datetime(non_null, errors="coerce")
valid_datetime_ratio = float(
datetime_coerced.notna().sum() / len(non_null)
)
if valid_datetime_ratio > 0.9:
return "datetime"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Prioritize numeric inference before datetime for object columns

In _detect_logical_type the heuristic tries to coerce object columns to datetimes before attempting numeric detection. Because pandas.to_datetime accepts plain integers as nanosecond timestamps, an object column that is mostly numeric values with a few string placeholders (common in Excel sheets) will satisfy the valid_datetime_ratio > 0.9 check and the loader will tag it as datetime. _apply_schema will then cast those numeric values to datetime64[ns], corrupting columns such as ages or counts. You can reproduce with pd.Series([1,2,…,100,'?'], dtype=object) which yields datetime from this logic, while the correct classification is numeric. Swap the order so numeric coercion is tested before datetime to avoid misclassifying integer data as timestamps.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant