Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Q] stream asyncio dataframes to_dataframe usage #177

Open
hofab opened this issue May 10, 2018 · 0 comments
Open

[Q] stream asyncio dataframes to_dataframe usage #177

hofab opened this issue May 10, 2018 · 0 comments

Comments

@hofab
Copy link

hofab commented May 10, 2018

Hey guys,

Great work here, I just have a problem understanding how we translate a stream of dataframe so we can use tail() etc.

I have a coroutine, that emits dataframes to my stream.

from streamz import Stream
from tornado.ioloop import IOLoop

@gen.coroutine
def f():
    source = Stream(asynchronous=True)  # tell the stream we're working asynchronously
    example = pd.DataFrame({'x': []})
    sdf = source.to_dataframe(example=example)
    for x in range(10):
        yield gen.sleep(0.1)
        yield source.emit(readField())
    sdf.tail()
    sdf.cumsum()
    print(sdf)

IOLoop().run_sync(f)

with:

@asyncio.async
def readField():
    """ 
    asynchronously - Blocking IO operation
    """
    df = pd.DataFrame({'x': [SomeValues]})
    return df

As output I get:

DataFrame - elements like:
Empty DataFrame
Columns: [x]
Index: []

I am not sure if thats the way we are looking to use the to_DataFrame.

I basically want to send my dataframes to a stream, translate it to bigger dataframes (window etc.) and perform some dynamic printing on the resulting frames. But somehow it seems, that my data is not transmitted to my stream.

Any idea/help would be appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant