pyam icon indicating copy to clipboard operation
pyam copied to clipboard

Add `pyam.read_excel` and `pyam.read_csv` functions

Open danielhuppmann opened this issue 2 years ago • 0 comments

Per a discussion by @l-welder and @coroa on Slack...

Description

pyam currently uses pyam.IamDataFrame(<file>) to read data from an xlsx or csv file, which is different from specific top-level functions implemented by pandas: pandas.read_excel() and pandas.read_csv().

To add to the confusion, pyam has a utility method read_file() which is exposed as a package top-level function but does not return an IamDataFrame.

Proposed solution

  • Refactor read_file() to make it an internal method to reduce confusion
  • Add classmethods pyam.read_excel and pyam.read_csv that initialize an IamDataFrame

For discussion

Should we add a deprecation-warning when initializing an IamDataFrame from file as pyam.IamDataFrame(<file>)? Or simply allow two parallel approaches going forward?

danielhuppmann avatar Aug 21 '22 13:08 danielhuppmann