-
-
Save merlin-quix/406da5e06fd0b19bea1bff8396135796 to your computer and use it in GitHub Desktop.
OSS announcement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a projection for columns we need. | |
df = input_stream.df[["gForceX", "gForceY", "gForceZ"]] | |
# Create new feature by simply combining three columns to one new column. | |
df["gForceTotal"] = df["gForceX"].abs() + df["gForceY"].abs() + df["gForceZ"].abs() | |
# Calculate rolling window of previous column for last 10 minutes | |
df["gForceTotal_avg10s"] = df["gForceTotal"].rolling("10m").mean() | |
# Loop through the stream row by row as data frow through the service. | |
# Async iterator will stop the code if there is no new data incoming from i | |
async for row in df: | |
print(row) | |
await output_stream.write(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment