dovpanda-dev / dovpanda

Directions overlay for working with pandas in an analysis environment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error at suggest_at_iat function

mfanselmo opened this issue · comments

Brief Description

When using this method, the hint throws an error.

self.data.groupby(by="Class").count().idxmax()[0]

What that line does is find the most repeated class (column) in the dataframe. (probably there is a better way)

System Information

  • Windows 10 pro
  • Notebook
  • Python version : 3.7.4

Minimally Reproducible Code

import pandas as pd
import dovpandas

a = pd.DataFrame({"id": [1, 2, 3, 4, 5, 6],"Class": ['a', 'a', 'b', 'a', 'b', 'c']})

a.groupby(by="Class").count().idxmax()[0]

Error Messages

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-5-fe782dc356aa> in <module>
      1 a = pd.DataFrame({"id": [1, 2, 3, 4, 5, 6],"Class": ['a', 'a', 'b', 'a', 'b', 'c']})
      2 
----> 3 a.groupby(by="Class").count().idxmax()[0]

c:\users\marti\appdata\local\programs\python\python37\lib\site-packages\dovpanda\base.py in run(*args, **kwargs)
    161                 for post in posts:
    162                     if self.similar <= post.stop_nudge:
--> 163                         post.replacement(ret, arguments)
    164             return ret
    165 

c:\users\marti\appdata\local\programs\python\python37\lib\site-packages\dovpanda\core.py in suggest_at_iat(res, arguments)
    186 def suggest_at_iat(res, arguments):
    187     self = arguments.get('self')
--> 188     shp = res.shape
    189     if res.ndim < 1:  # Sometimes specific slicing will return value
    190         return

AttributeError: 'str' object has no attribute 'shape'

thanks. Managed to reproduce. will fix for next minor version.