def __init__(self, data, **kwargs):
        """Initialize an instance of an IamDataFrame"""
        # import data from pd.DataFrame or read from source
        if isinstance(data, pd.DataFrame) or isinstance(data, pd.Series):
            _data = format_data(data.copy(), **kwargs)
        elif has_ix and isinstance(data, ixmp.TimeSeries):
            _data = read_ix(data, **kwargs)
        else:
            _data = read_file(data, **kwargs)

        self.data, self.time_col, self.extra_cols = _data
        # cast time_col to desired format
        if self.time_col == 'year':
            self._format_year_col()
        elif self.time_col == 'time':
            self._format_datetime_col()

        self._LONG_IDX = IAMC_IDX + [self.time_col] + self.extra_cols

        # define a dataframe for categorization and other metadata indicators
        self.meta = self.data[META_IDX].drop_duplicates().set_index(META_IDX)
        self.reset_exclude()

        # execute user-defined code
        if 'exec' in run_control():
            self._execute_run_control()
def __init__ ( self , data , ** kwargs ) : if isinstance ( data , pd . DataFrame ) or isinstance ( data , pd . Series ) : _data = format_data ( data . copy ( ) , ** kwargs ) elif has_ix and isinstance ( data , ixmp . TimeSeries ) : _data = read_ix ( data , ** kwargs ) else : _data = read_file ( data , ** kwargs ) self . data , self . time_col , self . extra_cols = _data if self . time_col == 'year' : self . _format_year_col ( ) elif self . time_col == 'time' : self . _format_datetime_col ( ) self . _LONG_IDX = IAMC_IDX + [ self . time_col ] + self . extra_cols self . meta = self . data [ META_IDX ] . drop_duplicates ( ) . set_index ( META_IDX ) self . reset_exclude ( ) if 'exec' in run_control ( ) : self . _execute_run_control ( )
Initialize an instance of an IamDataFrame