False warning: "Unexpected Argument" when using the pandas package.

I am using PyCharm 2020.2.3 (Community Edition) and pandas 1.1.3

When I'm using pandas.DataFrame.drop_duplicates after pandas.concat and pandas.DataFrame.sort_values I'm getting an false warning of "Unexpected Argument".

See an example of code:

import pandas as pd


def main() -> None:
    df = pd.concat(objs=[])
    df = df.sort_values(by=[])
    df = df.drop_duplicates(subset=[])


if __name__ == '__main__':
    main()

Upload id: 2020_10_25_Df62vHDTdCnM8R2R (file: bug.txt)

Thanks!

1
8 comments

Hello, 

 

Could you please provide me with a working example? The attached code  execution fails. 

 

Thank you! 

0

This is still an issue with Pandas + PyCharm. In the following example, code inspection will claim that `days` is an unexpected argument.

Take the following, for example. According the code and docs for pd.DateOffset, it can accept a large number of inputs like `day`, `days`, etc. https://github.com/pandas-dev/pandas/blob/797f23efcf9c5eeeed06749493aa0a5c5baf5514/pandas/_libs/tslibs/offsets.pyi#L260 .

The following code throws in an "Unexpected Argument" error in PyCharm despite being valid. Its attempt to create a function signature for this thinly-wrapped C function has failed to identify the keyword arguments pd.DateOffset can handle.

pd.DateOffset(days=5)
0
The following code shows no warnings for me in PyCharm 2022.3.2

```
import pandas as pd
pd.DateOffset(days=5)
```

Please update to the latest version if you haven't already and verify if the issue persists.
0

I updated to 2022.3.2 and still see the error for this line when used in one of my existing projects but not another.

It's possible that the generated function signature has not been recreated for one of my projects and this bug has been solved. Is there a way I can kick-start regeneration of it?

0
Please try **File | Invalidate Caches... | (Check all boxes) Invalidate and Restart**

Also, please check if you have `pandas-stubs` or other third-party stubs installed and try uninstalling them.
0

I invalidated all the caches and restarted but still observe the "Unexpected argument" warning.

I don't have any add-ons matching "pandas" and I didn't know what stubs were until now. If there were any, there would be an asterisk in the gutter, and there is none.

0

Could you please submit a bug report to https://youtrack.jetbrains.com/issues/py and post a link here, so I could take a look? 

Please attach the following to the report:

- logs from **Help | Collect Logs and Diagnostic Data**

- A screenshot of the whole IDE window showing your project structure and the issue

- The output of `pip list` for your interpreter.

0

Please sign in to leave a comment.