Skip to content Skip to sidebar Skip to footer

Calling Pandas From Within Class

My code goes like this: import pandas as pd class some_class(): def __init__(self,date): self.start = pd.to_datetime(date) print self.start day = '2017-0

Solution 1:

Well, no answer so far. I needed it badly (or close to badly) and used this workaround: just imported pandas to my mod.py

class some_class():

def__init__(self, date):
    import pandas as pd
    self.start = pd.to_datetime(date)
    print self.start

Not ideal but works.

So I suspect there exists two different namespaces. If so, this solution unnecessary load pandas to mod.py's namespace. I will post more when I look more into this problem .

Post a Comment for "Calling Pandas From Within Class"