Python Forum
%matplotlib inline , invalid syntax - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: %matplotlib inline , invalid syntax (/thread-11503.html)



%matplotlib inline , invalid syntax - yamoon - Jul-12-2018

Dear All

I'm trying to use %matplotlib inline to show the heatmap but i'm getting an error "Invalid syntax", can any body help to solve the problem, here is my code:

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline

train = pd.read_csv('titanic_train.csv')

train.head(10)

sns.heatmap(train.isnull(), yticklabels=False, cbar=False, cmap='viridis')



RE: %matplotlib inline , invalid syntax - volcano63 - Jul-12-2018

%matplotlib inline
calls iPython "magic" function, it will not work in a script