anishmehta24 commented on code in PR #41733:
URL: https://github.com/apache/beam/pull/41733#discussion_r4746686353
##########
sdks/python/apache_beam/dataframe/frames_test.py:
##########
@@ -2320,6 +2320,32 @@ def test_agg_list_with_count_and_size(self):
df = pd.DataFrame({'A': [1.0, None, 3.0, 4.0], 'B': [2, 3, 5, 7]})
self._run_test(lambda df: df.agg(['count', 'mean']), df)
+ def test_min_max_all_na_partition(self):
+ # Each test partition holds a single row here, so the NA rows make
+ # partitions with only missing values.
+ df = pd.DataFrame({
+ 'td': pd.to_timedelta([None, 5, None, 2], unit='s'),
+ 'tz': pd.to_datetime([None, '2024-01-05', None,
+ '2024-01-02']).tz_localize('UTC'),
+ 'int': pd.array([None, 5, None, 2], dtype='Int64'),
+ 'str': pd.array([None, 'b', None, 'a'], dtype='string'),
+ })
+ # TODO(https://github.com/apache/beam/issues/20926): max and min produce
Review Comment:
Yes, the proxy itself was still wrong: it is computed from the empty proxy,
where min and max give NaN, so it came out float64 or NaT instead of the
column's type. 1c3cf69 now computes the final proxy from a one-row sample of
the column dtype, so this TODO and the four in the agg tests above are removed.
The check stays off only for `agg(['min', 'max'], skipna=False)` here, where
both results are NA and pandas picks the dtype from those NA values.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]