uchicago-cs / deepdish

Flexible HDF5 saving/loading and other data science tools from the University of Chicago
http://deepdish.io
BSD 3-Clause "New" or "Revised" License
271 stars 60 forks source link

I followed example in http://deepdish.io/ but 'numpy.ndarray' object has no attribute 'tobytes' #5

Closed stray-leone closed 9 years ago

stray-leone commented 9 years ago

I run the example code in http://deepdish.io/ However, at datum.data = X[i].tobytes() error came. I know that error is come from deepdish but I don't know the reason and I want to run example code Do you know the reason the problem ??

My numpy version is 1.8.2

gustavla commented 9 years ago

I believe it should be X[i].tostring() prior to numpy 1.9.

gustavla commented 9 years ago

I added a note about this to the blog post. Thanks for pointing this out!

I know this will fix it, so I'm closing this issue.

Mottotime commented 8 years ago

I think a better solution might be adding some test code:

            if float(np.__version__[0:3]) < 1.9:
                datum.data = X[i].tostring()
            else:
                datum.data = X[i].tobytes()