I was trying to use plotly to plot a ohlc chart. However, it kept saying that the module object is not callable. However, with the same codes, the author was able to do it in the tutorial i followed.
import pandas as pd
import plotly.plotly as py
import plotly.graph_objs as go
df = pd.read_csv(“USDCAD_hour.csv”)
df.columns = [‘date’,‘open’,‘high’,‘low’,‘close’,‘volume’]
df.date = pd.to_datetime(df.date,format="%d.%m.%Y %H:%M:%S.%f")
df = df.set_index(df.date)
df = df.drop_duplicates(keep=False)
trace = go.ohlc(x=df.index,open=df.open, high=df.high,low=df.low,close=df.close, name=‘usdcad’)
Could you put your code in a fenced code block (https://help.github.com/articles/creating-and-highlighting-code-blocks/) and include the full error message and stack trace (This usually indicates which line caused the exception).
Hi, Jmmease. thank you for your reply. I found out why i got the error. it is because my case was wrong (ohlc should be Ohlc)
This error statement TypeError: ‘module’ object is not callable is raised as you are being confused about the Class name and Module name. The problem is in the import line . You are importing a module, not a class. This happend because the module name and class name have the same name .
If you have a class “MyClass” in a file called “MyClass.py” , then you should import :
from MyClass import MyClass
In Python , a script is a module, whose name is determined by the filename . So when you start out your file MyClass.py with import MyClass you are creating a loop in the module structure.
-- coding: utf-8 --
Editor de Spyder
from sympy import symbol
from sympy import integrate
from scipy.integrate import quad
print (integrate(x3+x2+1, x))