Chan Mean Reversion code - Sec 3, Unit 14

Sec 3, Unit 14



At the very top of the code when I put this into a file and run it I get an error message



Code Snippet:


For data manupulation

import numpy as np

import pandas as pd


For plotting

import matplotlib.pyplot as plt

%matplotlib inline

from pandas.plotting import register_matplotlib_converters

register_matplotlib_converters()


For checking cointegration

from johansen import coint_johansen



import warnings

warnings.filterwarnings('ignore')



Error Message:



runfile('C:/python/RUN_ME.py', wdir='C:/python')

  File "<string>", line 13

    %matplotlib inline

    ^

SyntaxError: invalid syntax



I thought % was a c style formatting character.  Can you tell me what the code should be at this point.



Thanks

%matplotlib is a magic command in the Jupyter notebook. Refer to this link to read more. 

If you are using this command in Spyder IDE, this won't work. You can comment or remove it.