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

DOC : Delete args and kwargs from pandas.Grouper #58397

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tuhinsharma121
Copy link
Contributor

@tuhinsharma121
Copy link
Contributor Author

@mroeschke I need your help here. After these changes 3 tests are failing

FAILED pandas/tests/groupby/aggregate/test_aggregate.py::test_agg_multiple_functions_same_name - TypeError: Grouper.__new__() got multiple values for argument 'key'
FAILED pandas/tests/groupby/aggregate/test_aggregate.py::test_agg_multiple_functions_same_name_with_ohlc_present - TypeError: Grouper.__new__() got multiple values for argument 'key'
FAILED pandas/tests/groupby/test_timegrouper.py::TestGroupBy::test_groupby_with_timegrouper - TypeError: Grouper.__new__() got multiple values for argument 'key'

The error looks like this

>           result1 = df.resample("5D").sum()

pandas/tests/groupby/test_timegrouper.py:121: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/core/generic.py:9011: in resample
    return get_resampler(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

obj =                     Buyer  Quantity
Date                               
2013-09-01 13:00:00  Carl        18
2013-09-01...l         5
2013-10-03 10:00:00  Carl         1
2013-12-02 12:00:00   Joe         9
2013-09-02 14:00:00  Carl         3
kwds = {'closed': None, 'convention': 'start', 'freq': '5D', 'group_keys': False, ...}

    def get_resampler(obj: Series | DataFrame, **kwds) -> Resampler:
        """
        Create a TimeGrouper and return our resampler.
        """
>       tg = TimeGrouper(obj, **kwds)  # type: ignore[arg-type]
E       TypeError: Grouper.__new__() got multiple values for argument 'key'

pandas/core/resample.py:1864: TypeError

I am not able to debug where this extra key is getting passed. Can you please help me here?

@tuhinsharma121 tuhinsharma121 deleted the pandas-grouper-delete-args branch April 26, 2024 02:57
@tuhinsharma121 tuhinsharma121 restored the pandas-grouper-delete-args branch April 26, 2024 03:10
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

Successfully merging this pull request may close these issues.

DOC: pandas.Grouper should not accept args and kwargs and should have permanent arguments
1 participant