roger-mike commented on a change in pull request #15827:
URL: https://github.com/apache/beam/pull/15827#discussion_r756250175
##########
File path: sdks/python/apache_beam/dataframe/frames_test.py
##########
@@ -1100,6 +1100,82 @@ def test_dt_tz_localize_nonexistent(self):
'Europe/Warsaw', ambiguous='NaT', nonexistent=pd.Timedelta('1H')),
s)
+ def test_idxmin(self):
+ df = pd.DataFrame({
+ 'consumption': [10.51, 103.11, 55.48],
+ 'co2_emissions': [37.2, 19.66, 1712]
+ },
+ index=['Pork', 'Wheat Products', 'Beef'])
+
+ df2 = df.copy()
+ df2.loc['Pork', 'co2_emissions'] = None
+ df2.loc['Wheat Products', 'consumption'] = None
+ df2.loc['Beef', 'co2_emissions'] = None
+
+ df3 = pd.DataFrame({
+ 'consumption': [1.1, 2.2, 3.3], 'co2_emissions': [3.3, 2.2, 1.1]
+ },
+ index=[0, 1, 2])
+
+ s = pd.Series(data=[4, 3, None, 1], index=['A', 'B', 'C', 'D'])
+ s2 = pd.Series(data=[1, 2, 3], index=[1, 2, 3])
+
+ self._run_test(lambda df: df.idxmin(), df)
+ self._run_test(lambda df: df.idxmin(skipna=False), df)
+ self._run_test(lambda df: df.idxmin(axis=1), df)
+ self._run_test(lambda df: df.idxmin(axis=1, skipna=False), df)
+
+ self._run_test(lambda df2: df2.idxmin(), df2)
+ self._run_test(lambda df2: df2.idxmin(axis=1), df2)
+
+ # These tests are failing
Review comment:
Not sure how to handle the `skipna=False` case when there are NaNs in
the DataFrame or Series. The expected type is different from the proxy's type.
I don't know how it can be inferred. @TheNeuralBit Do you have any examples of
how this can be done?
--
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]