Fix all udf pytests - #21731
Conversation
|
@galipremsagar did the output type of UDFs change in pandas 3? |
That is not the real issue. The core problem is that |
|
Should we be putting this cast into our actual |
|
So will a any UDF that returns a null now return object dtype in pandas? I would think we'd get the nullable dtype with a true null. |
There is no change in dtypes returned by pandas or cudf udfs. The change happened in In [1]: import pandas as pd
In [2]: pd.__version__
Out[2]: '3.0.1'
In [3]: import numpy as np
In [4]: l = pd.Series([np.nan])
In [5]: r = pd.Series([pd.NA])
In [7]: pd.testing.assert_series_equal(l, r, check_dtype=False)
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[7], line 1
----> 1 pd.testing.assert_series_equal(l, r, check_dtype=False)
[... skipping hidden 2 frame]
File pandas/_libs/testing.pyx:53, in pandas._libs.testing.assert_almost_equal()
File pandas/_libs/testing.pyx:171, in pandas._libs.testing.assert_almost_equal()
File /raid/pgali/envs/cudfdev/lib/python3.13/site-packages/pandas/_testing/asserters.py:619, in raise_assert_detail(obj, message, left, right, diff, first_diff, index_values)
616 if first_diff is not None:
617 msg += f"\n{first_diff}"
--> 619 raise AssertionError(msg)
AssertionError: Series are different
Series values are different (100.0 %)
[index]: [0]
[left]: [nan]
[right]: [<NA>]
At positional index 0, first diff: nan != <NA>In [1]: import pandas as pd
In [2]: import numpy as np
In [3]: pd.__version__
Out[3]: '2.3.3'
In [4]: l = pd.Series([np.nan])
In [5]: r = pd.Series([pd.NA])
In [6]: pd.testing.assert_series_equal(l, r, check_dtype=False)
<ipython-input-6-ea3eeb97a7f8>:1: FutureWarning: Mismatched null-like values nan and <NA> found. In a future version, pandas equality-testing functions (e.g. assert_frame_equal) will consider these not-matching and raise.
pd.testing.assert_series_equal(l, r, check_dtype=False)
I agree that we should fix our |
vyasr
left a comment
There was a problem hiding this comment.
In the interest of the cudf test suite becoming usable again on the pandas3 branch I'm OK with changing the test for now, but we're just kicking the can a short way down the road since we'll have to deal with the pandas test suite very soon.
The style check is failing, make sure to fix that before merging.
brandon-b-miller
left a comment
There was a problem hiding this comment.
I see whats happening here now, cuDF and pandas return the same thing but the equality comparison was going through non-nullable dtypes. This change seems fine to me.
## Description This PR fixes all pytest failures in `test_apply` similar to #21731 This PR fixes 28 pytest failures. ## Checklist - [x] I am familiar with the [Contributing Guidelines](https://github.com/rapidsai/cudf/blob/HEAD/CONTRIBUTING.md). - [x] New or existing tests cover these changes. - [x] The documentation is up to date with these changes.
Description
This PR fixes type assertion issues in udf tests.
pandas3:This PR:
Checklist