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

tqdm.pandas() progress_apply issue #4638

Closed
yanxke opened this issue Jul 22, 2023 · 4 comments
Closed

tqdm.pandas() progress_apply issue #4638

yanxke opened this issue Jul 22, 2023 · 4 comments
Assignees

Comments

@yanxke
Copy link

yanxke commented Jul 22, 2023

Object of type "Series[Unknown]" is not callable on the progress_apply() part.

Environment data

  • Language Server version: v2023.7.30
  • OS and version: Windows 11
  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.6

Code Snippet

import pandas as pd
from tqdm import tqdm

def foo(df: pd.DataFrame) -> pd.DataFrame:
    def bar(row: pd.Series):
            return pd.NA

    tqdm.pandas()
    df["distance"] = df.progress_apply(bar, axis=1)

    return df
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Jul 22, 2023
@judej
Copy link
Contributor

judej commented Sep 6, 2023

Thanks for the report, unfortunately, this is not enough data for us to debug. I've tried it and don't see the Series[Unknown]" is not callable on version v2023.8.50

If this continues to be a problem, would you please reopen the issue and add the information in the report as described in the troubleshooting guide?

@judej judej closed this as completed Sep 6, 2023
@yanxke
Copy link
Author

yanxke commented Sep 11, 2023

It still appears in the latest version.

image

image

2023-09-11 09:09:43.655 [info] Experiment 'pythonPromptNewFormatterExt' is active
2023-09-11 09:09:43.655 [info] Experiment 'pythonPromptNewToolsExt' is active
2023-09-11 09:09:43.655 [info] Experiment 'pythonTestAdaptercf' is active
2023-09-11 09:09:43.655 [info] Test server listening.
2023-09-11 09:09:43.655 [info] Python interpreter path: C:\Python311\python.exe
2023-09-11 09:09:53.332 [info] > conda info --json
2023-09-11 09:09:55.463 [info] > ~\.conda\Scripts\conda.exe info --json
2023-09-11 09:09:55.472 [info] > ~\miniconda3\envs\labelme\Scripts\conda.exe info --json
2023-09-11 09:09:55.478 [info] > ~\miniconda3\Scripts\conda.exe info --json
2023-09-11 09:09:55.483 [info] > ~\miniconda3\envs\crawlpg\Scripts\conda.exe info --json
2023-09-11 09:09:56.708 [info] Starting Pylance language server.

logs.txt

@yanxke
Copy link
Author

yanxke commented Sep 11, 2023

Logs attached. @judej could you reopen the issue?

@debonte debonte reopened this Sep 11, 2023
@debonte debonte assigned debonte and unassigned heejaechang Sep 11, 2023
@debonte
Copy link
Contributor

debonte commented Sep 11, 2023

Pylance ships with the pandas stubs from pandas-stubs. These stubs do not show a progress_apply member on DataFrame, so Pylance is falling back to the DataFrame.__getattr__ stub which returns a Series.

Static type checkers like Pylance don't have any way of knowing that tqdm has dynamically added the progress_apply member to DataFrame. If you feel that this should be improved, I would suggest filing an issue in the tqdm issue tracker.

@debonte debonte closed this as completed Sep 11, 2023
@debonte debonte added by design and removed needs repro Issue has not been reproduced yet labels Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants