I am taking EP Chan's Mean reversion in Python course. In the Johansen test section, in the libraries being imported, one of them is "from johansen import coint_johansen". However when I try this, I get an error saying "No Module named 'johansen''. Can you please help me figure out how to get the Johansen module installed for my Python? I tried to google it but cannot find anything obvious that I am missing.
The module johansen could be found in the Section 9 - Unit 2 (Downloadable Resources). Once you download the zip file, the johansen.py file is stored in the stationarity test folder.
When I download the file and unzip it in the same folder where I am running my Python notebook, and try to use “from johansen import coint_johansen”, i get an error again but this time it says “FileNotFoundError: File b’GLD1.csv’ does not exist”. I am trying to use johansen test for somethign else, and not the example of GLD and GDX. Is there any way to get this johansen module independlty such that it is not related to the GLD/GDX example? Thank you.
You can comment out the following line from your Python notebook pd.read_csv(“GLD1.csv”,index_col=0) and instead read the file name you want to import. Please note to save the csv file you want to read in same folder as your Python notebook.
The module johansen.py in the stationarity test folder is an independent module and can be used for any data set.
I hope this solves your query.