Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: read_csv #1551

Merged
merged 3 commits into from
Dec 10, 2024
Merged

feat: read_csv #1551

merged 3 commits into from
Dec 10, 2024

Conversation

raisadz
Copy link
Contributor

@raisadz raisadz commented Dec 10, 2024

What type of PR is this? (check all applicable)

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

@github-actions github-actions bot added the enhancement New feature or request label Dec 10, 2024
Comment on lines 970 to 972
>>> agnostic_read_csv(native_namespace=pd) # doctest:+SKIP
>>> agnostic_read_csv(native_namespace=pl) # doctest:+SKIP
>>> agnostic_read_csv(native_namespace=pa) # doctest:+SKIP
Copy link
Member

Choose a reason for hiding this comment

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

even though the example is being skipped, can we still show a sample dataframe as output?
like

   a  b
0  1  4
1  2  5
2  3  6

for pandas

shape: (3, 2)
┌─────┬─────┐
│ a   ┆ b   │
│ --- ┆ --- │
│ i64 ┆ i64 │
╞═════╪═════╡
│ 1   ┆ 4   │
│ 2   ┆ 5   │
│ 3   ┆ 6   │
└─────┴─────┘

for polars

pyarrow.Table
a: int64
b: int64
----
a: [[1,2,3]]
b: [[4,5,6]]

for pyarrow

?

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

awesome, thanks! just some minor comments


def test_read_csv(
tmpdir: pytest.TempdirFactory,
constructor: Constructor,
Copy link
Member

Choose a reason for hiding this comment

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

shall we just use constructor_eager, is this is only implemented in the eager case anyway?

Comment on lines +42 to +43
result = nw_v1.read_csv(filepath, native_namespace=native_namespace)
assert_equal_data(result, data)
Copy link
Member

Choose a reason for hiding this comment

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

can we also check that result is a nw_v1.DataFrame? (isinstance)

@raisadz raisadz marked this pull request as ready for review December 10, 2024 14:43
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

thanks @raisadz !

@MarcoGorelli MarcoGorelli merged commit bb2561b into narwhals-dev:main Dec 10, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: read_csv
2 participants