How to use the streamz.dataframe.DataFrame 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 python-streamz / streamz / streamz / core.py View on Github external
def to_dataframe(self, example):
        """ Convert a stream of Pandas dataframes to a DataFrame

        Examples
        --------
        >>> source = Stream()
        >>> sdf = source.to_dataframe()
        >>> L = sdf.groupby(sdf.x).y.mean().stream.sink_to_list()
        >>> source.emit(pd.DataFrame(...))  # doctest: +SKIP
        >>> source.emit(pd.DataFrame(...))  # doctest: +SKIP
        >>> source.emit(pd.DataFrame(...))  # doctest: +SKIP
        """
        from .dataframe import DataFrame
        return DataFrame(stream=self, example=example)
github KloudTrader / libkloudtrader / abc.py View on Github external
import pandas as pd
import random
from streamz import Stream
from streamz.dataframe import DataFrame
stream = Stream()
while True:
    example = pd.DataFrame([{'name': random.uniform(1,10), 'amount': random.uniform(10,20)}])
    sdf = DataFrame(stream, example=example)
    print(sdf)
#sdf[sdf.name == 'Alice'].amount.sum()
github snth / numismatic / numismatic / collectors / dataframe.py View on Github external
dict_stream = event_type_stream.map(attr.asdict)

        if self.interval:
            data_stream = dict_stream.timed_window(interval=self.interval)
        else:
            # ensure downstream receives lists rather than elements
            data_stream = dict_stream.partition(1)

        # stream of DataFrames
        df_stream = data_stream.filter(len).map(
            partial(pd.DataFrame.from_records, 
                    columns=events_dataframe.columns)
        )

        # create a DataFrame
        sdf = DataFrame(df_stream, example=events_dataframe)

        sdf.stream.sink(self.write)
github python-streamz / streamz / streamz / dataframe / holoviews.py View on Github external
-------
        Element : Element or NdOverlay of Elements
        """
        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')