Python Forum
%matplotlib inline , invalid syntax
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
%matplotlib inline , invalid syntax
#1
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')
Reply
#2
%matplotlib inline
calls iPython "magic" function, it will not work in a script
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to find what is causing the unboundlocalerror 'crumb' and invalid syntax error? JonathanBanks 1 2,261 Jul-28-2020, 11:46 AM
Last Post: Yoriz
  SyntaxError: invalid syntax Truman 3 2,908 Mar-10-2020, 03:16 PM
Last Post: Truman
  list comprehension invalid syntax mcgrim 1 4,599 Jun-12-2019, 08:28 PM
Last Post: Yoriz
  Help: how to deal with a invalid Matplotlib date value when use {gca()} pythopen 2 31,763 Oct-18-2018, 08:37 PM
Last Post: pythopen
  Misterious invalid syntax Galedon 3 3,426 Mar-30-2018, 03:49 PM
Last Post: Galedon

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020