Skip to content

Instantly share code, notes, and snippets.

@Steboss89
Created June 8, 2021 16:01
Show Gist options
  • Save Steboss89/963df2670f3a80eec39564653a0f02f6 to your computer and use it in GitHub Desktop.
Save Steboss89/963df2670f3a80eec39564653a0f02f6 to your computer and use it in GitHub Desktop.
Impl of HousingDataset
pub fn new(v: Vec<&str>) -> HousingDataset {
// note we have declared a new vector of &strings, remember borrowship, which will be a struct HousingDatset
// as input we are receiving a string from the csv file.
// we are going to decode this as a f64 vector using the unwrap function
let unwrapped_text: Vec<f64> = v.iter().map(|r| r.parse().unwrap()).collect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment