Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing total for DataFrame.progress_apply #351

Closed
kpj opened this issue Feb 19, 2017 · 5 comments
Closed

Missing total for DataFrame.progress_apply #351

kpj opened this issue Feb 19, 2017 · 5 comments

Comments

@kpj
Copy link

kpj commented Feb 19, 2017

Hello,

I am using tqdm version 4.11.2 and pandas version 0.19.2.
When I try the minimal example

import pandas as pd
from tqdm import tqdm

tqdm.pandas()
df = pd.DataFrame({1:[1], 2:[2], 3:[3]})
foo = df.progress_apply(lambda x: x+1)

the output is

4it [00:00, 2616.13it/s]

instead of a progressbar counting up to 4.

Am I missing something? I took a short peek at the code, but total seems to be set correctly, so I am not sure what exactly is going on.

#299 seems to be a similar issue, but focuses on a different problem, I think.

@cancan101
Copy link
Contributor

For some reason the total is set for Series but not for DataFrames. See:

tqdm/tqdm/_tqdm.py

Lines 511 to 512 in ed6e0b4

total = len(df) if isinstance(df, Series) \
else df.size // len(df)
:

total = len(df) if isinstance(df, Series) else df.size // len(df)

where: df.size // len(df)==1

@cancan101
Copy link
Contributor

I think the issue is whether the apply is along axis 0 or axis 1.

@kpj
Copy link
Author

kpj commented Jul 16, 2017

Perfect, it seems to work now.
Thanks a lot!

@casperdcl
Copy link
Sponsor Member

Great. Note to self: we should probably add a unit test to prevent against future regressions

@casperdcl
Copy link
Sponsor Member

think unit tests are now in #524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants