Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to save dataframe to CSV file #2312

Closed
liwen-alt opened this issue Jul 4, 2020 · 6 comments
Closed

How to save dataframe to CSV file #2312

liwen-alt opened this issue Jul 4, 2020 · 6 comments

Comments

@liwen-alt
Copy link

the function writetable()
image

@bkamins
Copy link
Member

bkamins commented Jul 4, 2020

using CSV

and then

CSV.write(file, table; kwargs...)

or

table |> CSV.write(file; kwargs...)

@bkamins bkamins closed this as completed Jul 4, 2020
@liwen-alt
Copy link
Author

this method can write dataframe to csv file

@bkamins
Copy link
Member

bkamins commented Jul 4, 2020

yes, is something not working in what I have referenced to?

@liwen-alt
Copy link
Author

this is my coding, I will the df1 write into a .csv file ,i can choice,this method can satisfy the needing?
cn = zeros(Float64,100)
aa = zeros(Float64,100)
ra = zeros(Float64,100)
pa = zeros(Float64,100)
lhn1 = zeros(Float64,100)
jaccard = zeros(Float64,100)
lp = zeros(Float64,100)
auc = zeros(Float64,100)
precison = zeros(Float64,100)
for j = 1 : length(datasets)
for i = 1 : 100
data = load_example_data(datasets[j])
net = DivideNet(data,0.9)
train = net[1]
test = net[2]
cn[i]=CN(train)
aa[i]=AA(train)
ra[i]=RA(train)
pa[i]=PA(train)
lhn1[i]=LHN1(train)
jaccard[i]=Jaccard(train)
lp[i]=LP(train,0.001)
end
df1 = DataFrame()
df1[:CNsim] = cn
df1[:AAsim] = aa
df1[:RAsim] = ra
df1[:PAsim] = pa
df1[:LHN1sim] = lhn1
df1[:Jaccardsim] = jaccard
df1[:LPsim] = lp
CSV.write(df1,'100sim.csv')
end

@bkamins
Copy link
Member

bkamins commented Jul 4, 2020

Please check the signature I have provided. You should write:

CSV.write("100sim.csv", df)

Also note that ' is not a valid delimiter of strings in Julia

@liwen-alt
Copy link
Author

ok,thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants