You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/12/01 15:15:00 UTC

[jira] [Work logged] (BEAM-12560) Implement idxmin and idxmax for DataFrame, Series, and GroupBy

     [ https://issues.apache.org/jira/browse/BEAM-12560?focusedWorklogId=688731&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-688731 ]

ASF GitHub Bot logged work on BEAM-12560:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Dec/21 15:14
            Start Date: 01/Dec/21 15:14
    Worklog Time Spent: 10m 
      Work Description: roger-mike commented on a change in pull request #15827:
URL: https://github.com/apache/beam/pull/15827#discussion_r760280960



##########
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:
       Got it 👍 




-- 
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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 688731)
    Time Spent: 6h 40m  (was: 6.5h)

> Implement idxmin and idxmax for DataFrame, Series, and GroupBy
> --------------------------------------------------------------
>
>                 Key: BEAM-12560
>                 URL: https://issues.apache.org/jira/browse/BEAM-12560
>             Project: Beam
>          Issue Type: Improvement
>          Components: dsl-dataframe
>            Reporter: Brian Hulette
>            Assignee: Mike Hernandez
>            Priority: P3
>          Time Spent: 6h 40m
>  Remaining Estimate: 0h
>
> Add an implementation of [idxmin|https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.idxmin.html] and [idxmax|https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.idxmax.html] for DeferredDataFrame, DeferredSeries, and DeferredGroupBy. It should be fully unit tested with some combination of pandas_doctests_test.py and frames_test.py.
> https://github.com/apache/beam/pull/14274 is an example of a typical PR that adds new operations. See https://lists.apache.org/thread.html/r8ffe96d756054610dfdb4e849ffc6a741e826d15ba7e5bdeee1b4266%40%3Cdev.beam.apache.org%3E for background on the DataFrame API.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)