Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
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())
–
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.