Python Forum

Full Version: %matplotlib inline , invalid syntax
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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')
%matplotlib inline
calls iPython "magic" function, it will not work in a script