narwhals icon indicating copy to clipboard operation
narwhals copied to clipboard

feat: add ConstructorEager type

Open lucianosrp opened this issue 1 year ago • 3 comments

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

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

Related issues

  • Related issue #
  • Closes #1013

Checklist

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

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

lucianosrp avatar Sep 28 '24 15:09 lucianosrp

Getting some issues with type checking.

tests/expr_and_series/sort_test.py:30: error: Item "NativeFrame" of "NativeFrame | DataFrame[Any] | DataFrameLike" has no attribute "equals"  [union-attr]
tests/expr_and_series/sort_test.py:30: error: Item "DataFrame[Any]" of "NativeFrame | DataFrame[Any] | DataFrameLike" has no attribute "equals"  [union-attr]
tests/expr_and_series/sort_test.py:30: error: Item "DataFrameLike" of "NativeFrame | DataFrame[Any] | DataFrameLike" has no attribute "equals"  [union-attr]

Should I also add equals to the NativeFrame protocol?

EDIT: I ended up removing the typehint on sort_test.py:30 as I don't think any dataframe would have the equals method (?)

lucianosrp avatar Sep 28 '24 15:09 lucianosrp

~Not sure how to handle the mypy failure on interchange_to_arrow_test and interchange_schema_test this time. @FBruzzesi , perhaps you could have a look? I am sure I am missing something very obvious haha~

Solved

lucianosrp avatar Oct 06 '24 09:10 lucianosrp

Getting some issues with type checking.

tests/expr_and_series/sort_test.py:30: error: Item "NativeFrame" of "NativeFrame | DataFrame[Any] | DataFrameLike" has no attribute "equals"  [union-attr]
tests/expr_and_series/sort_test.py:30: error: Item "DataFrame[Any]" of "NativeFrame | DataFrame[Any] | DataFrameLike" has no attribute "equals"  [union-attr]
tests/expr_and_series/sort_test.py:30: error: Item "DataFrameLike" of "NativeFrame | DataFrame[Any] | DataFrameLike" has no attribute "equals"  [union-attr]

Should I also add equals to the NativeFrame protocol?

EDIT: I ended up removing the typehint on sort_test.py:30 as I don't think any dataframe would have the equals method (?)

I think you can rewrite the test as follows:

    result = (
        df.select(
            "a",
            nw.col("b").sort(descending=descending, nulls_last=nulls_last),
        )
    )
    compare_dicts(result, expected)

MarcoGorelli avatar Oct 06 '24 09:10 MarcoGorelli

This has been stale for a while. I'll try to make it right this weekend 🔥

lucianosrp avatar Oct 16 '24 20:10 lucianosrp

Many thanks @MarcoGorelli ! I will merge it now🎉

lucianosrp avatar Oct 17 '24 10:10 lucianosrp