1

Hi I am trying to use ggplot library in Python. So I pip install gglot in my Anaconda command prompt. I tried basic plotting (Example from http://ggplot.yhathq.com/docs/geom_density.html) in jupyter notebook. But I am getting error saying 'TypeError: 'module' object is not callable'. There is no error while running the import statement of ggplot in the noteobok. But I am getting error while running the ggplot() + geom statement.

from ggplot import *
df = pd.DataFrame({
    "x": np.random.normal(0, 10, 1000),
    "y": np.random.normal(0, 10, 1000),
    "z": np.random.normal(0, 10, 1000)
})
df = pd.melt(df)

ggplot(aes(x='value', color='variable'), data=df) + \
    geom_density()

TypeError Traceback (most recent call last)
<ipython-input-12-162182859f18> in <module>()
      6 df = pd.melt(df)
      7 
----> 8 ggplot(aes(x='value', color='variable'), data=df) +     geom_density()

TypeError: 'module' object is not callable

Is there something I am missing here ?

1 Answer 1

0

Looks like ggplot is a module rather than a class. You should either do ggplot.ggplot(<snip>) or change your import to from ggplot import ggplot.

Sign up to request clarification or add additional context in comments.

Comments

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.