Cannot load dataframes with datetime objects

User 1191 | 5/4/2015, 5:45:15 PM

Hello, I'm trying to load a dataframe with the following fields into an SFrame

>>data_frame.dtypes
time                        datetime64[ns]
tid                                  int64
MKTprev30min                       float64
ZMRprev30min                       float64
MKTprev1day                        float64
ZMRprev1day                        float64
ZMRnext1day                        float64
ZMRnext10day                       float64

and I keep getting this error:

>>SFrame(data_frame)

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-110-c6bd9f5d68f5> in <module>()
----> 1 SFrame(data_frame)

/home/firdaus/local/software/lib/python2.7/site-packages/graphlab/data_structures/sframe.pyc in __init__(self, data, format, _proxy)
    858                     pass
    859                 else:
--> 860                     raise ValueError('Unknown input type: ' + format)
    861 
    862         sframe_size = -1

/home/firdaus/local/software/lib/python2.7/site-packages/graphlab/cython/context.pyc in __exit__(self, exc_type, exc_value, traceback)
     37     def __exit__(self, exc_type, exc_value, traceback):
     38         if not self.show_cython_trace and exc_type:
---> 39             raise exc_type(exc_value)

AttributeError: 'numpy.datetime64' object has no attribute 'year'

Any suggestions will be appreciated. I'm using graphlab version '1.3.0' with Python 2.7.6 Thanks.

Comments

User 91 | 5/4/2015, 6:11:14 PM

Unfortunately, this feature (conversion of date-time to Pandas dataframes) is not implemented yet. The workaround would be to cast them as String and then cast them back to Datetime using strtodatetime.