Julia Language, Working with Data

Categories
using DataFrames
using DelimitedFiles
using CSV
using XLSX
using Downloads
#in cmd , type julia to enter julia
# type ; in julia to enter shell it's like shell mode and having normal terminal session 
# change directory to the folder of project 
# hit backspace to get back to normal julia mode. 
# the dependencies are in a file named:  project.toml
#enter ] to go to the package mode
# enter: activate . 
# it would activate the environment because it is inside project.toml and Manifest.toml
# now type: status it will show packages that we do not have with an arrow 
# packages marked with → not downloaded, use `instantiate` to download
# to get R call : ENV["R_HOME"]="*"
# using Pkg 
# Pkg.build("RCall")
P = Downloads.download("https://raw.githubusercontent.com/nassarhuda/easy_data/master/programming_languages.csv",
    "programming_languages.csv")
# Read & write Text file
P,H = readdlm("programming_languages.csv",',';header=true);
# read & write CSV
C = CSV.read("programming_languages.csv", DataFrame);
CSV.write("programminglanguages_CSV.csv", DataFrame(P, :auto))
# read and Write XLSX
T = XLSX.readdata("data/zillow_data_download_april2020.xlsx", #file name
    "Sale_counts_city", #sheet name
    "A1:F9" #cell range
    )
# T would be a matrix
DataFrame(T, :auto)

# with specified cell range
G = XLSX.readtable("data/zillow_data_download_april2020.xlsx","Sale_counts_city");

D = DataFrame(G...) # equivalent to DataFrame(G[1],G[2])
foods = ["apple", "cucumber", "tomato", "banana"]
calories = [105,47,22,105]
prices = [0.85,1.6,0.8,0.6,]
dataframe_calories = DataFrame(item=foods,calories=calories)
dataframe_prices = DataFrame(item=foods,price=prices)

DF = innerjoin(dataframe_calories,dataframe_prices,on=:item)
XLSX.writetable("writefile_using_XLSX.xlsx",G[1],G[2])