Skip to content

Add usage examples to read_csvs docstring - #1759

Open
iMalcolmS wants to merge 2 commits into
pyjanitor-devs:devfrom
iMalcolmS:docs/read-csvs-examples-1755
Open

iMalcolmS wants to merge 2 commits into
pyjanitor-devs:devfrom
iMalcolmS:docs/read-csvs-examples-1755

Conversation

@iMalcolmS

Copy link
Copy Markdown

Closing #1755

was added examples to the read_csvs docstring covering:

  • reading files that match a glob pattern into one DataFrame
  • separate_df=True returning a dict keyed by file name
  • passing an explicit list of paths, plus extra kwargs forwarded to pandas.read_csv

The examples write small CSVs to a temporary directory and clean up afterwards, so they run as doctests. The glob example sorts the output because glob order isn't guaranteed across platforms.

Tested locally: pytest --doctest-modules janitor/io.py -k read_csvs passes.

@codecov

codecov Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.94%. Comparing base (901f4b3) to head (461503e).
⚠️ Report is 262 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1759      +/-   ##
==========================================
+ Coverage   87.56%   89.94%   +2.37%     
==========================================
  Files          95      107      +12     
  Lines        6819     6761      -58     
==========================================
+ Hits         5971     6081     +110     
+ Misses        848      680     -168     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread janitor/io.py Outdated
>>> from janitor import read_csvs
>>> folder = tempfile.mkdtemp()
>>> pd.DataFrame({"id": [1, 2], "city": ["Lisbon", "Porto"]}).to_csv(
... os.path.join(folder, "sales_2024.csv"), index=False

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

let's use pathlib

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done, boss ✅

Comment thread janitor/io.py Outdated
... os.path.join(folder, "sales_2024.csv"), index=False
... )
>>> pd.DataFrame({"id": [3], "city": ["London"]}).to_csv(
... os.path.join(folder, "sales_2025.csv"), index=False

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

pathlib

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done, boss ✅

Comment thread janitor/io.py Outdated
Comment thread janitor/io.py Outdated

@samukweku samukweku left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

appreciate the contribution. I requested some changes.

@iMalcolmS
iMalcolmS force-pushed the docs/read-csvs-examples-1755 branch from 28f8062 to 461503e Compare October 13, 2026 08:03

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants