1
$\begingroup$

I want to make a histogram plot, after importing the library called graphing it gives me an error even when it has been installed.

import graphing

graphing.histogram(dataset, label_x='Pclass', label_y='Survived', histfunc='avg', include_boxplot=True)

And here's the error message.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_15336\3609384830.py in <module>
      1 import graphing
      2 
----> 3 graphing.histogram(dataset, label_x='Pclass', label_y='Survived', histfunc='avg', include_boxplot=True)

AttributeError: module 'graphing' has no attribute 'histogram'

Do you have some advice on how to handle this? Thank you

$\endgroup$

1 Answer 1

0
$\begingroup$

The error message is telling you that Python has managed to import the graphing package, but that the package has no attribute/function called histogram.

Some possible explanations are:

  • This is the wrong name for the function you want (in matplotlib, which you've tagged, the function is hist not histogram).
  • The function is in a sub-module of graphing, so you need to call graphing.<submodule>.histogram.
  • You are importing the wrong graphing package. You can use variables such as graphing.__path__ (which tells you where the package has been loaded from) to help work out if this is the problem.
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.