Skip to content

Commit

Permalink
Fix word-count tutorial and add printing
Browse files Browse the repository at this point in the history
  • Loading branch information
daniil-quix committed Dec 19, 2024
1 parent 1f3d5ef commit 8432907
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/tutorials/anomaly-detection/tutorial_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def main():
sdf = sdf.apply(lambda result: round(result["value"], 2)).filter(
should_alert, metadata=True
)
# .to_topic() does not require reassignment ("in-place" operation), but does no harm
sdf = sdf.to_topic(alerts_topic)
sdf.print()
sdf.to_topic(alerts_topic)

app.run()

Expand Down
5 changes: 3 additions & 2 deletions docs/tutorials/purchase-filtering/tutorial_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ def main():
]
sdf["Full Name"] = sdf.apply(get_full_name)
sdf = sdf[["Full Name", "Email"]]
# .to_topic() does not require reassignment ("in-place" operation), but does no harm
sdf = sdf.to_topic(customers_qualified_topic)

sdf.print()
sdf.to_topic(customers_qualified_topic)

app.run()

Expand Down
9 changes: 5 additions & 4 deletions docs/tutorials/word-count/tutorial_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@ def main():
sdf = app.dataframe(source=ReviewGenerator())
sdf = sdf.apply(tokenize_and_count, expand=True)
sdf = sdf.filter(should_skip)
# .to_topic() does not require reassignment ("in-place" operation), but does no harm
sdf = sdf.to_topic(
word_counts_topic, key=lambda word_count_pair: word_count_pair[0]
)
sdf.print()
sdf.to_topic(word_counts_topic, key=lambda word_count_pair: word_count_pair[0])

# Start the application
app.run()


# This approach is necessary since we are using a Source
Expand Down

0 comments on commit 8432907

Please sign in to comment.