def write_from_sid_df_pairs(self,
                                country_code,
                                data,
                                scaling_factors=None):
        """
        Parameters
        ----------
        country_code : str
            The ISO 3166 alpha-2 country code for this country.
        data : iterable[tuple[int, pandas.DataFrame]]
            The data chunks to write. Each chunk should be a tuple of
            sid and the data for that asset.
        scaling_factors : dict[str, float], optional
            A dict mapping each OHLCV field to a scaling factor, which
            is applied (as a multiplier) to the values of field to
            efficiently store them as uint32, while maintaining desired
            precision. These factors are written to the file as metadata,
            which is consumed by the reader to adjust back to the original
            float values. Default is None, in which case
            DEFAULT_SCALING_FACTORS is used.
        """
        data = list(data)
        if not data:
            empty_frame = pd.DataFrame(
                data=None,
                index=np.array([], dtype='datetime64[ns]'),
                columns=np.array([], dtype='int64'),
            )
            return self.write(
                country_code,
                {f: empty_frame.copy() for f in FIELDS},
                scaling_factors,
            )

        sids, frames = zip(*data)
        ohlcv_frame = pd.concat(frames)

        # Repeat each sid for each row in its corresponding frame.
        sid_ix = np.repeat(sids, [len(f) for f in frames])

        # Add id to the index, so the frame is indexed by (date, id).
        ohlcv_frame.set_index(sid_ix, append=True, inplace=True)

        frames = {
            field: ohlcv_frame[field].unstack()
            for field in FIELDS
        }

        return self.write(country_code, frames, scaling_factors)
def write_from_sid_df_pairs ( self , country_code , data , scaling_factors = None ) : data = list ( data ) if not data : empty_frame = pd . DataFrame ( data = None , index = np . array ( [ ] , dtype = 'datetime64[ns]' ) , columns = np . array ( [ ] , dtype = 'int64' ) , ) return self . write ( country_code , { f : empty_frame . copy ( ) for f in FIELDS } , scaling_factors , ) sids , frames = zip ( * data ) ohlcv_frame = pd . concat ( frames ) sid_ix = np . repeat ( sids , [ len ( f ) for f in frames ] ) ohlcv_frame . set_index ( sid_ix , append = True , inplace = True ) frames = { field : ohlcv_frame [ field ] . unstack ( ) for field in FIELDS } return self . write ( country_code , frames , scaling_factors )
Parameters
        ----------
        country_code : str
            The ISO 3166 alpha-2 country code for this country.
        data : iterable[tuple[int, pandas.DataFrame]]
            The data chunks to write. Each chunk should be a tuple of
            sid and the data for that asset.
        scaling_factors : dict[str, float], optional
            A dict mapping each OHLCV field to a scaling factor, which
            is applied (as a multiplier) to the values of field to
            efficiently store them as uint32, while maintaining desired
            precision. These factors are written to the file as metadata,
            which is consumed by the reader to adjust back to the original
            float values. Default is None, in which case
            DEFAULT_SCALING_FACTORS is used.