>>> %matplotlib inline results in SyntaxError: invalid syntax

Mike S mscir at yahoo.com
Fri Jan 29 02:04:29 EST 2016


I have installed Python 3.4.4 on XPSP3 and am trying to work my way 
through this tutorial.

A Complete Tutorial on Ridge and Lasso Regression in Python
http://www.analyticsvidhya.com/blog/2016/01/complete-tutorial-ridge-lasso-regression-python/

In Step 2 "Why Penalize the Magnitude of Coefficients?" we are shown 
this code:

#Importing libraries. The same will be used throughout the article.
import numpy as np
import pandas as pd
import random
import matplotlib.pyplot as plt
%matplotlib inline

I get an error on the last line. I am running this code in Idle Python 
3.4.4 Shell...

Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 
bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
 >>> import numpy as np
 >>> import pandas as pd
 >>> import random
 >>> import matplotlib.pyplot as plt
 >>> %matplotlib inline
SyntaxError: invalid syntax

What am I doing wrong? Suggested reading?
TIA,
Mike



More information about the Python-list mailing list