Skip to content

Instantly share code, notes, and snippets.

@guenter-r
Created May 27, 2020 11:43
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 guenter-r/7274ec3fbf349ed7ce70444bf0be1f1a to your computer and use it in GitHub Desktop.
Save guenter-r/7274ec3fbf349ed7ce70444bf0be1f1a to your computer and use it in GitHub Desktop.
Import data Julia
using CSV
using DataFrames
using Statistics
data = CSV.read("./iris_data.txt",header=false)
## no more head
first(data,5)
# renaming column header
rename!(data, Symbol.(["sepal_length","sepal_width","petal_length","petal_width","class"]))
unique(data."class")
## map values to class - we are using a dict here // Have you heard R, YES, real dictionaries
let d=Dict(:"Iris-setosa" => 0, :"Iris-versicolor" => 1, :"Iris-virginica" => 2)
data[:class] = map(elt->d[elt], data[:class])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment