Giter Site home page Giter Site logo

Comments (3)

oppsig avatar oppsig commented on June 3, 2024 1

Thanks a lot, tried this but still caught same error. Gonna play around to see if i can manage to get it it work but if you want to take a look, then here is my entire script.

https://pastebin.com/KWVGETZg

When i convert the 'Date' column data with 'to_datetime' does it get converted to some sort of object?
The conversion works fine but i guess backtest.start is having problems looping threw the dates (trainStart, trainEnd ect) for some reason.
Can datetime have different formats, like the one your telling me to convert to '%Y-%m-%d

I also changed this to use the same format. Will i need to convert this also to datetime or does your module do this?

trainStart = '2015-11-01'       # Start of training period
trainEnd   = '2017-11-01'       # End of training period
testStart  = '2017-11-02'       # Start of testing period
testEnd   = '2017-11-17'       # End of testing period

Here's the error.

Traceback (most recent call last):
  File "clair2.py", line 36, in <module>
    backtest.start(data, kernel='rbf', C=1, gamma=10)
  File "/home/kodi/.local/lib/python3.5/site-packages/clairvoyant/engine.py", line 197, in start
    Engine.start(self, data, **kwargs)
  File "/home/kodi/.local/lib/python3.5/site-packages/clairvoyant/engine.py", line 50, in start
    for i in range(self.trainStr, self.trainEnd+1):
TypeError: Can't convert 'int' object to str implicitly

from clairvoyant.

anfederico avatar anfederico commented on June 3, 2024

Getting your data ready is actually separate from the module. You can do it however you want. All you need to do is make sure your data column in your pandas dataframe is converted to datetime.

Looking at your CSV file, you want to do something like this

import pandas as pd

data = read_csv("file.csv")                                                                                                                                      
data = data.round(3)                                                                                                       
data['Date'] = pd.to_datetime(data.Date, format="%Y-%m-%d")                                                                                          

# 2015-01-02 = %Y-%m-%d

Also, what are the features you're using?

from clairvoyant.

anfederico avatar anfederico commented on June 3, 2024

Closing this, use a numerical index on your dataframe if you're still having issues.

from clairvoyant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.