def series_fetch_by_relname(self, name, column):
        """ Construct DataFrame with component timeseries data from filtered
        table data.

        Parameters
        ----------
        name : str
            Component name.
        column : str
            Component field with timevarying data.

        Returns
        -------
        pd.DataFrame
            Component data.
        """

        ormclass = self._mapped[name]

        # TODO: This is implemented in a not very robust way.
        id_column = re.findall(r'[A-Z][^A-Z]*', name)[0] + '_' + 'id'
        id_column = id_column.lower()

        query = self.session.query(
            getattr(ormclass, id_column),
            getattr(ormclass, column)[self.start_snapshot: self.end_snapshot].
            label(column)).filter(and_(
                ormclass.scn_name == self.scn_name,
                ormclass.temp_id == self.temp_id))

        if self.version:
            query = query.filter(ormclass.version == self.version)

        df = pd.io.sql.read_sql(query.statement,
                                self.session.bind,
                                columns=[column],
                                index_col=id_column)

        df.index = df.index.astype(str)

        # change of format to fit pypsa
        df = df[column].apply(pd.Series).transpose()

        try:
            assert not df.empty
            df.index = self.timeindex
        except AssertionError:
            print("No data for %s in column %s." % (name, column))

        return df
def series_fetch_by_relname ( self , name , column ) : ormclass = self . _mapped [ name ] id_column = re . findall ( r'[A-Z][^A-Z]*' , name ) [ 0 ] + '_' + 'id' id_column = id_column . lower ( ) query = self . session . query ( getattr ( ormclass , id_column ) , getattr ( ormclass , column ) [ self . start_snapshot : self . end_snapshot ] . label ( column ) ) . filter ( and_ ( ormclass . scn_name == self . scn_name , ormclass . temp_id == self . temp_id ) ) if self . version : query = query . filter ( ormclass . version == self . version ) df = pd . io . sql . read_sql ( query . statement , self . session . bind , columns = [ column ] , index_col = id_column ) df . index = df . index . astype ( str ) df = df [ column ] . apply ( pd . Series ) . transpose ( ) try : assert not df . empty df . index = self . timeindex except AssertionError : print ( "No data for %s in column %s." % ( name , column ) ) return df
Construct DataFrame with component timeseries data from filtered
        table data.

        Parameters
        ----------
        name : str
            Component name.
        column : str
            Component field with timevarying data.

        Returns
        -------
        pd.DataFrame
            Component data.