Created
May 27, 2020 11:43
-
-
Save guenter-r/7274ec3fbf349ed7ce70444bf0be1f1a to your computer and use it in GitHub Desktop.
Import data Julia
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
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