jmcarpenter2 / swifter

A package which efficiently applies any function to a pandas dataframe or series in the fastest available manner
MIT License
2.53k stars 102 forks source link

can not work on DataFrameGroupBy apply? #226

Open WangHHY19931001 opened 10 months ago

WangHHY19931001 commented 10 months ago

i had install swifter\swifter[notebook]\swifter[groupby] by pip,but as you see, it not work

swifter in c:\users\dell\miniconda3\envs\mrposition_update_with_py310\lib\site-packages (1.4.0) swifter[notebook] in c:\users\dell\miniconda3\envs\mrposition_update_with_py310\lib\site-packages (1.4.0) swifter[groupby] in c:\users\dell\miniconda3\envs\mrposition_update_with_py310\lib\site-packages (1.4.0) pandas>=1.0.0 in c:\users\dell\miniconda3\envs\mrposition_update_with_py310\lib\site-packages (from swifter[groupby]) (2.1.4) ray>=1.0.0 in c:\users\dell\miniconda3\envs\mrposition_update_with_py310\lib\site-packages (from swifter[groupby]) (2.9.0)

finger_df = finger_df.groupby(['f_sid', 'f_msisdn']).swifter.apply(group_bt) File "C:\Users\dell\miniconda3\envs\mrposition_update_with_py310\lib\site-packages\pandas\core\groupby\groupby.py", line 1312, in getattr raise AttributeError( AttributeError: 'DataFrameGroupBy' object has no attribute 'swifter'

chenyangkang commented 9 months ago

This is mentioned in #210. Change the expression.

df.groupby('x').swifter.apply(...)-> df.swifter.groupby('x').apply(...)

WangHHY19931001 commented 8 months ago

This is mentioned in #210. Change the expression.

df.groupby('x').swifter.apply(...)-> df.swifter.groupby('x').apply(...)

may change all api to xx.swifter.xxx.apply will been batter