Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to fix this?
#1
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
Larz60+ write Dec-26-2023, 03:09 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply
#2
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
Reply


Forum Jump:

User Panel Messages

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