TimeSeriesClustering.jl icon indicating copy to clipboard operation
TimeSeriesClustering.jl copied to clipboard

A question about TimeSeriesClustering.jl

Open 1256ABCDE opened this issue 5 years ago • 4 comments

image `using TimeSeriesClustering

ts_input_data = load_timeseries_data("D:\mycode\code\。。。。.csv"; T=24, years=[2016]) ` ERROR: LoadError: MethodError: objects of type Bool are not callable Stacktrace: [1] find_column_name(::DataFrames.DataFrame, ::Array{Symbol,1}; error::Bool) at C:\Users\dadou.juliapro\JuliaPro_v1.4.2-1\packages\TimeSeriesClustering\3T6SG\src\utils\load_data.jl:161 [2] find_column_name at C:\Users\dadou.juliapro\JuliaPro_v1.4.2-1\packages\TimeSeriesClustering\3T6SG\src\utils\load_data.jl:153 [inlined] [3] add_timeseries_data!(::Dict{String,Array}, ::SubString{String}, ::DataFrames.DataFrame; K::Int64, T::Int64, years::Array{Int64,1}) at C:\Users\dadou.juliapro\JuliaPro_v1.4.2-1\packages\TimeSeriesClustering\3T6SG\src\utils\load_data.jl:131 [4] add_timeseries_data!(::Dict{String,Array}, ::SubString{String}, ::String; K::Int64, T::Int64, years::Array{Int64,1}) at C:\Users\dadou.juliapro\JuliaPro_v1.4.2-1\packages\TimeSeriesClustering\3T6SG\src\utils\load_data.jl:116 [5] load_timeseries_data(::String; region::String, T::Int64, years::Array{Int64,1}, att::Array{String,1}) at C:\Users\dadou.juliapro\JuliaPro_v1.4.2-1\packages\TimeSeriesClustering\3T6SG\src\utils\load_data.jl:50 [6] top-level scope at D:\mycode\code\测试.jl:3 in expression starting at D:\mycode\code\测试.jl:3

I’m running the example on the official website. Why did I get an error?thanks!!!

1256ABCDE avatar Jul 09 '20 06:07 1256ABCDE

Something in the path of the csv does not look correct, you may want to check if this is the true filename of the csv. (the four dots)

holgerteichgraeber avatar Feb 12 '21 06:02 holgerteichgraeber

I am using julia v.1.5.3 and I had same problem. And I found that 130 and 131 lines in load_data.jl are time_name=find_column_name(data, [:Timestamp, :timestamp, :Time, :time, :Zeit, :zeit, :Date, :date, :Datum, :datum]; error=false) year_name=find_column_name(data, [:year, :Year, :jahr, :Jahr])

and 154~155 lines are +++++++++++++++++++ for name in name_itr if name in names(df) col_name=name break end end ++++++++++++++++++++++ therefore col_name is always :none

+++++++++++++++++++++++++++++++++++++++++++ solutions : I can fix like that if name in names(df) -> if name in Symbol.(names(df)) +++++++++++++++++++++++++++++++++++++++++++

jookty avatar Feb 17 '21 00:02 jookty

@jookty, could you create a merge request with your solution?

YoungFaithful avatar Feb 19 '21 12:02 YoungFaithful

Hi, I have the same problem. This is my Julia version.

Julia Version 1.7.2 Commit bf53498635 (2022-02-06 15:21 UTC) Platform Info: OS: Windows (x86_64-w64-mingw32) CPU: AMD Ryzen 7 5800H with Radeon Graphics WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-12.0.1 (ORCJIT, znver3)

I tried the suggestions that @jookty offered. It almost worked. But I have another problem follows

WARNING: both StatsBase and Distances export "pairwise"; uses of it in module Clustering must be qualified

It seems a confliction between Distances packages and StatsBase. It has been solved after I degraded the Distances version to 0.7.0.

Xinhe-Chen avatar Mar 22 '22 19:03 Xinhe-Chen