question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENH: option to force slow code path (don't call apply function 1 too many times) in GroupBy.apply

See original GitHub issue
>>> def applym(df):
...     print df.irow(0)['a']
...     return DataFrame({'a':[1],'b':[1]})

>>> df = DataFrame({'a':[1,1,1,2,3],'b':['a','a','a','b','c']})

>>> df.groupby('b').apply(applym)
1
1
2
3
     a  b
b        
a 0  1  1
b 0  1  1
c 0  1  1
>>>

applym is called twice on the first group.

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Reactions:2
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
erwanpcommented, Jun 5, 2018

Also using groupby.apply() on little number of groups, that sometimes can be just 1 depending on User inputs. In that particular case the code is 2x slower.

An option to force the path would be quite appreciated.

1reaction
wesmcommented, Mar 19, 2013

Marked as enhancement for someday. Just have to get a groupby parameter to flow through

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pandas dataframe groupby + apply + new column is slow
In the current implementation apply calls func twice on the first group to decide whether it can take a fast or slow code...
Read more >
Slow in the Application, Fast in SSMS? - Erland Sommarskog
In this chapter we will look at how SQL Server compiles a stored procedure and uses the plan cache. If your application does...
Read more >
Fix list for IBM WebSphere Application Server V8.5
IBM WebSphere Application Server provides periodic fixes for the base and Network Deployment editions of release V8.5. The following is a complete listing ......
Read more >
Why pandas apply method is slow, and how Terality ...
This article will focus on the method apply with axis=1, which evaluates a function on every row. The axis=0 version evaluates a function...
Read more >
KEPServerEX Manual - Kepware
Auto generation produced too many overwrites, stopped posting error messages. ... Account '<name>' does not have permission to run this application.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found