Python Forum

Full Version: How to fix this?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have the following codes:

import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import pandas as pd
import statsmodels.api as sm
sns.set_style("darkgrid")
mpl.rcParams['figure.figsize'] = (20,5)

But I get the following errors:

--------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[2], line 19
16 # statsmodels.api for specifying models using formula strings and DataFrames.
18 sns.set_style("darkgrid")
---> 19 mpl.rcParams['figure.figsize'] = (20,5)

NameError: name 'mpl' is not defined
What is mpl supposed to be? None of the imports are named "mpl" and your code doesn't assign anything to a variable named mpl. rcParams looks like something in matplotlib. Are you missing this?
import matplotlib as mpl