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

initialise IamDataFrame with index #93

Merged
merged 5 commits into from Sep 21, 2018

Conversation

danielhuppmann
Copy link
Member

@danielhuppmann danielhuppmann commented Sep 18, 2018

Please confirm that this PR has done the following:

  • Tests Added
  • Documentation Added
  • Description in RELEASE_NOTES.md Added

Description of PR

This PR extends the IamDataFrame constructor to take a pd.DataFrame with a meaningful index, for example the dataframe returned by IamDataFrame.timeseries(). Closes #77

@gidden
Copy link
Member

gidden commented Sep 20, 2018

is this good to go?

@@ -169,6 +169,10 @@ def format_data(df):
df['scenario'] = scen.apply(
lambda s: '-'.join(s.split('-')[1:]).strip())

# reset the index if meaningful entries are included there
if not list(df.index.names) == [None]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I think you could do just if df.index.names:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just tried this, seems that this returns True even if no names are given

@danielhuppmann
Copy link
Member Author

thanks @gidden, good to go after the tests pass!

@gidden
Copy link
Member

gidden commented Sep 20, 2018 via email

@gidden gidden merged commit 8a9ed65 into IAMconsortium:master Sep 21, 2018
@danielhuppmann danielhuppmann deleted the init_with_index branch September 21, 2018 06:15
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.

None yet

2 participants