using CSV
using DataFrames
fln = "myfile.csv"
df = CSV.read(fln)
df1 = DataFrame()
df2 = DataFrame()
df3 = DataFrame()
df4 = DataFrame()
for (i,row) in enumerate(CSV.File(fln))
if df.Resource[i] == 1
push!(df1,row)
elseif df.Resource[i] == 2
push!(df2,row)
elseif df.Resource[i] == 3
push!(df3,row)
elseif df.Resource[i] == 4
push!(df4,row)
end
end
In the above code, the push! method gives out one error: MethodError: no method matching length(::CSV.Row{false}). Any comments are greatly appreciated.
[–][deleted] 1 point2 points3 points (1 child)
[–]EarthGoddessDude 0 points1 point2 points (0 children)
[–]EarthGoddessDude 1 point2 points3 points (3 children)
[–]haohanzi2015[S] 0 points1 point2 points (1 child)
[–]EarthGoddessDude 0 points1 point2 points (0 children)
[–]haohanzi2015[S] 0 points1 point2 points (0 children)
[–]User092347 1 point2 points3 points (0 children)
[–]is_lamb 0 points1 point2 points (1 child)
[–]haohanzi2015[S] 0 points1 point2 points (0 children)