I'm trying to call a module from pandas datetools, but am getting an error that the mofule object has no attribute by the name I'm calling. Wondering if anyone can shed some light on this issue. Below is the code I am trying to use:
import blpapi
import pandas as pd
from tia.bbg import LocalTerminal
import datetime
from pandas import datetools
sid = 'BKLN US EQUITY'
events = ['TRADE','AT_TRADE']
dt = pd.datetools.BDAY(-1).apply(pd.datetime.now())
And here is the error I am facing:
Traceback (most recent call last):
File "C:\bb_test.py", line 14, in <module>
dt = pd.datetools.BDAY(-1).apply(pd.datetime.now())
File "C:\Python27\lib\site-packages\pandas\util\_depr_module.py", line 61, in
__getattr__
obj = getattr(deprmodule, name)
AttributeError: 'module' object has no attribute 'BDAY'
First, consider that pandas datetools
is deprecated and will be removed in future releases.
But if you insist on using it, you need to pass timedelta
object to bday
function like follows:
import pandas as pd
from pandas import datetools
import datetime
from datetime import timedelta
# Constructing timedelta object
d = timedelta(days=-1)
# passing it to bday
pd.datetools.bday(d).apply(pd.datetime.now())