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

consistent return type in aggregate family of functions #255

Closed
gidden opened this issue Aug 8, 2019 · 1 comment
Closed

consistent return type in aggregate family of functions #255

gidden opened this issue Aug 8, 2019 · 1 comment
Assignees

Comments

@gidden
Copy link
Member

gidden commented Aug 8, 2019

At the moment, if df.aggregate_region() (and aggregate()) is called with append=False, a pd.DataFrame is returned with a specific, non-conforming pd.MultiIndex. This should be updated to the following:

        kwargs = dict(region=region, variable=variable)
        if append is True:
            self.append(_data, inplace=True, **kwargs)
        else:
            return IamDataFrame(_data, **kwargs)

Then, relevant tests will need to be updated to test for the new return type. An example test is provided in #254 in `test_feature_aggregate.py:

    # # this test should be updated to the below after the return type of
    # # aggregate_region() is updated
    # exp = check_aggregate_df.aggregate_region(
    #     'Primary Energy', region='foo', append=False
    # ).data
    # check_aggregate_df.aggregate_region(
    #     'Primary Energy', region='foo', append=True
    # )
    # obs = check_aggregate_df.filter(region='foo').data
    # assert len(exp) > 0
    # pd.testing.assert_frame_equal(obs.reset_index(drop=True),
    #                               exp.reset_index(drop=True))
@gidden gidden changed the title consistent return type in aggregate_region() consistent return type in aggregate family of functions Aug 8, 2019
@danielhuppmann
Copy link
Member

This issue has been resolved in the sequence of PRs #305, #312 and #315.

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

2 participants