Skip to content

Conversation

aplavin
Copy link
Contributor

@aplavin aplavin commented Aug 18, 2016

Note, this is still not an always-correct solution! May be we need to have separate logic for apply/map/applymap?..

else df.size // len(df)
if isinstance(df, Series):
total = len(df)
elif kwargs.get('axis', 0) == 0:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

axis may also be in args instead of kwargs... how to support it cleanly?

Copy link
Member

@lrq3000 lrq3000 Aug 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simply:

elif kwargs.get('axis', 0) == 0 or args[0] == 0:

Because the other arguments are not integers. But yeah it's not foolproof in the general, but I cannot see any better way to handle that. Here it should be enough.

Copy link
Contributor Author

@aplavin aplavin Aug 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, not foolproff, but I agree there is no other simple way. And btw, elif kwargs.get('axis', 0) == 0 or args and args[0] == 0: as there may be no arguments.

Or even kwargs.get('axis', args[0] if args else 0) == 0 - I myself like it better.

Copy link
Contributor Author

@aplavin aplavin Aug 18, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And after thinking a bit more, I would say we should either make separate functions for separate pandas ones, or disallow *args completely. For example, Series.apply(func, convert_dtype=True, args=(), **kwds) has the first argument as bool which can be passed value 0, and this can lead to very subtle bugs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we could disallow *args completely. We should just output a clear message that positional arguments are not supported with tqdm_pandas. This would be the best I think.

@coveralls
Copy link

coveralls commented Aug 18, 2016

Coverage Status

Coverage decreased (-0.8%) to 90.021% when pulling 5746868 on aplavin:patch-2 into 4b3d916 on tqdm:master.

@codecov-io
Copy link

codecov-io commented Aug 18, 2016

Current coverage is 88.77% (diff: 0.00%)

Merging #244 into master will decrease coverage by 1.73%

@@             master       #244   diff @@
==========================================
  Files             7          7          
  Lines           485        606   +121   
  Methods           0          0          
  Messages          0          0          
  Branches         89        130    +41   
==========================================
+ Hits            439        538    +99   
- Misses           44         66    +22   
  Partials          2          2          

Powered by Codecov. Last update 38af576...8bd27ff

@aplavin
Copy link
Contributor Author

aplavin commented Aug 18, 2016

And this certainly still doesn't work for applymap for example: it needs total = df.size.

@coveralls
Copy link

coveralls commented Aug 18, 2016

Coverage Status

Coverage decreased (-0.2%) to 90.586% when pulling 6a0f061 on aplavin:patch-2 into 4b3d916 on tqdm:master.

@aplavin
Copy link
Contributor Author

aplavin commented Aug 18, 2016

Well, there are other subtleties: for example, one can pass named axis (e.g. axis = 'index'), or for panels even two axes as a tuple. This patch doesn't support it.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.9%) to 89.834% when pulling d50ffb1 on aplavin:patch-2 into 4b3d916 on tqdm:master.

@lrq3000
Copy link
Member

lrq3000 commented Aug 18, 2016

Ah yes in this case it will be bothersome to handle all these special cases...

@lrq3000
Copy link
Member

lrq3000 commented Aug 26, 2016

@casperdcl What do you think of this PR? Can we merge it in?

@CrazyPython
Copy link
Contributor

args not supported intentionally -> args intentionally not supported

lemme send PR

@lrq3000
Copy link
Member

lrq3000 commented Aug 28, 2016

Thank's @CrazyPython :)

@lrq3000 lrq3000 added the to-review 🔍 Awaiting final confirmation label Aug 28, 2016
@lrq3000 lrq3000 mentioned this pull request Sep 6, 2016
4 tasks
@lrq3000 lrq3000 added the p0-bug-critical ☢ Exception rasing label Sep 15, 2016
@aplavin
Copy link
Contributor Author

aplavin commented Oct 1, 2016

Any updates on merging this?..

@CrazyPython
Copy link
Contributor

@aplavin merge typo PR

@lrq3000
Copy link
Member

lrq3000 commented Oct 1, 2016

Casper seems to be busy and I'm moving to another country so I don't yet
have a stable Internet connection, but by the end of october it will surely
be merged, along with lots of other PRs :)
Le 1 Oct. 2016 17:26, "Alexander" notifications@github.com a écrit :

Any updates on merging this?..


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#244 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABES3mZFCSPX_SJyX9mon78F2vPMcbHiks5qvnu0gaJpZM4Jnar0
.

@CrazyPython
Copy link
Contributor

  • Add tests
  • Get reviewed

@casperdcl
Copy link
Member

in #299.

@casperdcl casperdcl closed this Oct 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p0-bug-critical ☢ Exception rasing to-review 🔍 Awaiting final confirmation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants