Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
29 lines (24 sloc)
732 Bytes
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
#[macro_use] | |
extern crate agnes; | |
use agnes::source::csv::load_csv_from_uri; | |
// specify the GDP table (only the fields we are concerned about) | |
tablespace![ | |
table gdp { | |
CountryName: String, | |
CountryCode: String, | |
Gdp2015: f64, | |
} | |
]; | |
fn main() { | |
// specify the source location for our GDP fields | |
let gdp_schema = schema![ | |
fieldname gdp::CountryName = "Country Name"; | |
fieldname gdp::CountryCode = "Country Code"; | |
fieldname gdp::Gdp2015 = "2015"; | |
]; | |
// load the CSV file from a URI | |
let gdp_view = load_csv_from_uri("https://wee.codes/data/gdp.csv", gdp_schema) | |
.expect("CSV loading failed."); | |
// print the DataView | |
println!("{}", gdp_view); | |
} |