Link to home
Start Free TrialLog in
Avatar of chalie001
chalie001

asked on

TypeError: 'module' object is not callable

hi am geting this error
TypeError                                 Traceback (most recent call last)
<ipython-input-32-f71465f74ff4> in <module>
----> 1 plt.figure(figsize=(10))
      2 sns.boxplot(x='Pclass',y='Age',data=train)

TypeError: 'module' object is not callable

User generated image
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

What modules have you imported?
Also, the figsize requires a tuple of width and height to be passed e.g. figsize=(10,8)

Avatar of chalie001
chalie001

ASKER

i have

import pandas as pd
import numpy as np
import matplotlib as plt
import seaborn as sns
%matplotlib inline
 import import cufflinks as cf


plt.figure(figsize=(10.8))
sns.boxplot(x='Pclass',y='Age',data=train)
Try
import matplotlib.pyplot as plt

Open in new window


instead of

import matplotlib as plt

Open in new window


am geting

plt.figure(figsize=(10.8))
sns.boxplot(x='Pclass',y='Age',data=train)

TypeError                                 Traceback (most recent call last)
<ipython-input-51-e94594c8ce7a> in <module>
----> 1 plt.figure(figsize=(10.8))
      2 sns.boxplot(x='Pclass',y='Age',data=train)

C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\pyplot.py in figure(num, figsize, dpi, facecolor, edgecolor, frameon, FigureClass, clear, **kwargs)
    523                                         frameon=frameon,
    524                                         FigureClass=FigureClass,
--> 525                                         **kwargs)
    526
    527         if figLabel:

C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in new_figure_manager(cls, num, *args, **kwargs)
   3215         from matplotlib.figure import Figure
   3216         fig_cls = kwargs.pop('FigureClass', Figure)
-> 3217         fig = fig_cls(*args, **kwargs)
   3218         return cls.new_figure_manager_given_figure(num, fig)
   3219

C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\figure.py in __init__(self, figsize, dpi, facecolor, edgecolor, linewidth, frameon, subplotpars, tight_layout, constrained_layout)
    354             raise ValueError('figure size must be finite not '
    355                              '{}'.format(figsize))
--> 356         self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)
    357
    358         self.dpi_scale_trans = Affine2D().scale(dpi, dpi)

TypeError: from_bounds() argument after * must be an iterable, not float
ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial