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

Add an info() function and use in print(IamDataFrame) #427

Merged
merged 9 commits into from
Sep 23, 2020

Conversation

danielhuppmann
Copy link
Member

@danielhuppmann danielhuppmann commented Sep 23, 2020

Please confirm that this PR has done the following:

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

Description of PR

This PR adds an info() function similar to the pandas equivalent (read the docs) and when calling print() on an xarray object, which is the also used in print(df) (via __repr__).

The output in the first-steps tutorial is:

<class 'pyam.core.IamDataFrame'>
Index dimensions:
 * model    : AIM/CGE 2.1, GENeSYS-MOD 1.0, ... WITCH-GLOBIOM 4.4 (8)
 * scenario : 1.0, CD-LINKS_INDCi, CD-LINKS_NPi, ... Faster Transition Scenario (8)
 * region   : R5ASIA, R5LAM, R5MAF, R5OECD90+EU, R5REF, R5ROWO, World (7)
 * variable : ... (6)
 * unit     : EJ/yr, Mt CO2/yr, °C (3)
 * year     : 2010, 2020, 2030, 2040, 2050, 2060, 2070, 2080, ... 2100 (10)
Meta indicators:
   exclude (bool) False (1)

pyam/core.py Outdated Show resolved Hide resolved
pyam/core.py Outdated Show resolved Hide resolved
pyam/core.py Outdated Show resolved Hide resolved
@danielhuppmann
Copy link
Member Author

Rebased and implemented changes suggested by @Rlamboll in danielhuppmann#21:

  • adding number of unique items per index dimension and meta indicator type
  • smarter use of line width (can be set kwarg so that we can make it nicer in Jupyter notebooks later)
  • make showing memory usage optional

@danielhuppmann
Copy link
Member Author

merging as this has no direct implications on any workflow and formatting can be easily adapted later

@danielhuppmann danielhuppmann merged commit 015e8a6 into IAMconsortium:master Sep 23, 2020
@danielhuppmann danielhuppmann deleted the feature/print branch September 23, 2020 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants