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

Import Your Own Data

Open dsambor10 opened this issue 5 years ago • 6 comments

Hi, I tried importing my data via your instructions and when I run these lines:

my_path=joinpath(homedir(),"Documents","tutorial","TimeClustInput.csv")
your_data_1=load_timeseries_data(my_path; region="none", T=24)

I get this error: LoadError: MethodError: objects of type Bool are not callable

Sorry for the basic question! Dan

dsambor10 avatar Jun 05 '20 20:06 dsambor10

Hi @dsambor10, I suppose your TimeClustInput.csv contains true and false, is that correct?

YoungFaithful avatar Jun 13 '20 14:06 YoungFaithful

That's the confusing aspect, it does not. Is there a proper timestamp format that is required? Here's a snapshot of my data: image

dsambor10 avatar Jun 13 '20 18:06 dsambor10

Your timestamp column looks all right. However you need to add a column called Year. (That is due to the fact, that the timestamp is not really interpretated) https://holgerteichgraeber.github.io/TimeSeriesClustering.jl/stable/load_data/#Load-your-own-data-1

YoungFaithful avatar Jun 13 '20 18:06 YoungFaithful

Thanks for clarifying. I discovered the issue was that I had not specified in loading time series that "years=[2019]" because the doc said that's optional to designate and I thought it would read the year, but it's required to have I guess. It all works now. PS Is there any means of exporting the .clust_data (e.g. to a csv) once it's been clustered?

dsambor10 avatar Jun 15 '20 22:06 dsambor10

I don't think we have a function for that. Should be pretty simple to implement though:

using DataFrames

for (k,v) in X.clust_data.data  
  name = "$k"
  CSV.write(name*".csv", DataFrame(v))
end

clust_data is of type ClustData, and .data is a dictionary, see https://github.com/holgerteichgraeber/TimeSeriesClustering.jl/blob/master/src/utils/datastructs.jl

You may need to play with the settings of DataFrame and CSV.write, but this should give a general idea.

This will write one csv for each data type.

holgerteichgraeber avatar Jun 16 '20 05:06 holgerteichgraeber

I'm getting the same error that I and others have gotten in the past "objects of type Bool are not callable" (as per screenshot below) when I try to load my time series data (screenshot) below. It was working before but now appears to be an issue again. I've designated a year column and all my paths are correct. I'm loading my data with:

ts_input_data = load_timeseries_data("/home/dsambor/DanDocs/KLRS/Clust"; T=24,years=[2021])

image

image

dsambor10 avatar Oct 06 '21 19:10 dsambor10