Skip to content

Instantly share code, notes, and snippets.

@Stiivi
Created April 3, 2012 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Stiivi/2295299 to your computer and use it in GitHub Desktop.
Save Stiivi/2295299 to your computer and use it in GitHub Desktop.
Data Brewery - Aggregate a Remote CSV File
"""
Data Brewery Example
Aggregate a remote CSV file.
"""
import brewery
main = brewery.create_builder()
main.csv_source("https://raw.github.com/Stiivi/cubes/master/examples/hello_world/data.csv")
main.node.fields = brewery.FieldList([
"category_code",
"category",
"subcategory_code",
"subcategory",
"line_item",
"year",
["amount", "float"]
])
main.aggregate(keys=["year", "category"], measures=["amount"])
main.field_map(keep_fields=["year", "category", "amount_sum"])
main.pretty_printer()
main.stream.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment