How to use the streamz.dataframe.Series function in streamz

To help you get started, we’ve selected a few streamz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github holoviz / holoviews / holoviews / streams.py View on Github external
if not all(isinstance(v, np.ndarray) for v in data.values()):
                raise ValueError("Data in dictionary must be of array types.")
            elif len(set(len(v) for v in data.values())) > 1:
                raise ValueError("Columns in dictionary must all be the same length.")
            example = data
        else:
            try:
                from streamz.dataframe import StreamingDataFrame, StreamingSeries
                loaded = True
            except ImportError:
                try:
                    from streamz.dataframe import DataFrame as StreamingDataFrame, Series as StreamingSeries
                    loaded = True
                except ImportError:
                    loaded = False
            if not loaded or not isinstance(data, (StreamingDataFrame, StreamingSeries)):
                raise ValueError("Buffer must be initialized with pandas DataFrame, "
                                 "streamz.StreamingDataFrame or streamz.StreamingSeries.")
            elif isinstance(data, StreamingSeries):
                data = data.to_frame()
            example = data.example
            data.stream.sink(self.send)
            self.sdf = data

        if index and (util.pd and isinstance(example, util.pd.DataFrame)):
            example = example.reset_index()
        params['data'] = example
        super(Buffer, self).__init__(**params)
        self.length = length
        self._chunk_length = 0
        self._count = 0
        self._index = index
github holoviz / holoviews / holoviews / streams.py View on Github external
raise ValueError("Columns in dictionary must all be the same length.")
            example = data
        else:
            try:
                from streamz.dataframe import StreamingDataFrame, StreamingSeries
                loaded = True
            except ImportError:
                try:
                    from streamz.dataframe import DataFrame as StreamingDataFrame, Series as StreamingSeries
                    loaded = True
                except ImportError:
                    loaded = False
            if not loaded or not isinstance(data, (StreamingDataFrame, StreamingSeries)):
                raise ValueError("Buffer must be initialized with pandas DataFrame, "
                                 "streamz.StreamingDataFrame or streamz.StreamingSeries.")
            elif isinstance(data, StreamingSeries):
                data = data.to_frame()
            example = data.example
            data.stream.sink(self.send)
            self.sdf = data

        if index and (util.pd and isinstance(example, util.pd.DataFrame)):
            example = example.reset_index()
        params['data'] = example
        super(Buffer, self).__init__(**params)
        self.length = length
        self._chunk_length = 0
        self._count = 0
        self._index = index
github python-streamz / streamz / streamz / dataframe / holoviews.py View on Github external
"""
        return self(kind='table', **kwds)


# Register plotting interfaces
def df_plot(self):
    return HoloViewsFramePlot(self)


def series_plot(self):
    return HoloViewsSeriesPlot(self)


DataFrame.plot = property(df_plot)
DataFrames.plot = property(df_plot)
Series.plot = property(series_plot)
Seriess.plot = property(series_plot)

hv.extension('bokeh')
github holoviz / hvplot / hvplot / streamz.py View on Github external
def patch(name='hvplot', extension='bokeh', logo=False):
    from . import hvPlotTabular, post_patch

    try:
        import streamz.dataframe as sdf
    except ImportError:
        raise ImportError('Could not patch plotting API onto streamz. '
                          'Streamz could not be imported.')
    _patch_plot = lambda self: hvPlotTabular(self)
    _patch_plot.__doc__ = hvPlotTabular.__call__.__doc__
    patch_property = property(_patch_plot)
    setattr(sdf.DataFrame, name, patch_property)
    setattr(sdf.DataFrames, name, patch_property)
    setattr(sdf.Series, name, patch_property)
    setattr(sdf.Seriess, name, patch_property)

    post_patch(extension, logo)