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
Conversation
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]: |
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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
8e4b75c
to
d45b870
Compare
thanks @gidden, good to go after the tests pass! |
Ah, of course, it has an element. Oh well.
…On Thu, Sep 20, 2018 at 5:10 PM Daniel Huppmann ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pyam/utils.py
<#93 (comment)>:
> @@ -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]:
just tried this, seems that this returns True even if no names are given
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#93 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABVAEZ4uwS_aoYq_AxF9Q66I9ZjHq0nzks5uc6_4gaJpZM4Wulxe>
.
|
Please confirm that this PR has done the following:
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