Coder Social home page Coder Social logo

Weird error on int64 column about feather HOT 6 CLOSED

wesm avatar wesm commented on June 18, 2024
Weird error on int64 column

from feather.

Comments (6)

dan-tee avatar dan-tee commented on June 18, 2024

Should add that converting the column from np.int64 to np.int32 fixed the problem. Then it saved just fine.

from feather.

wesm avatar wesm commented on June 18, 2024

Can you let me know some more detail about your platform? The issue is that depending on your platform, NPY_INT64 may be either NPY_LONG or NPY_LONGLONG, and there may be code which sets NPY_LONGLONG (type=9) in spite of this. Easy to fix, but I'll have to look into a way to reproduce the error in a test case

from feather.

dan-tee avatar dan-tee commented on June 18, 2024

I'm using a 2015 retina MacBookPro with OS X 10.11. Thanks for looking into it.

from feather.

jd155 avatar jd155 commented on June 18, 2024

For what it's worth I got the same error when trying to save the following DataFrame. I have exactly the same OSX as dan-tee. Changing the columns to 'np.int32' also worked.

Data columns (total 5 columns):
Name Changed         433 non-null object
Name Changed         433 non-null int64
Name Changed         433 non-null int64
Name Changed         433 non-null int64
Name Changed         433 non-null int64
dtypes: int64(4), object(1)
memory usage: 20.3+ KB 

FeatherError                              Traceback (most recent call last)
<ipython-input-716-c3919d5846a7> in <module>()
      2 
      3 path = 'headcount.feather'
----> 4 feather.write_dataframe(Headcount, path)

/Users/Davies/anaconda/lib/python2.7/site-packages/feather/api.pyc in write_dataframe(df, path)
     33             name = str(name)
     34 
---> 35         writer.write_array(name, col)
     36 
     37     writer.close()

/Users/Davies/anaconda/lib/python2.7/site-packages/feather/ext.pyx in feather.ext.FeatherWriter.write_array (feather/ext.cpp:2130)()
     86             self.write_timestamp(name, col, mask)
     87         else:
---> 88             self.write_primitive(name, col, mask)
     89 
     90     cdef write_category(self, name, col, mask):

/Users/Davies/anaconda/lib/python2.7/site-packages/feather/ext.pyx in feather.ext.FeatherWriter.write_primitive (feather/ext.cpp:2435)()
    108 
    109         col_values = _unbox_series(col)
--> 110         self.write_ndarray(col_values, mask, &values)
    111         check_status(self.writer.get().AppendPlain(c_name, values))
    112 

/Users/Davies/anaconda/lib/python2.7/site-packages/feather/ext.pyx in feather.ext.FeatherWriter.write_ndarray (feather/ext.cpp:2742)()
    133     cdef int write_ndarray(self, values, mask, PrimitiveArray* out) except -1:
    134         if mask is None:
--> 135             check_status(pandas_to_primitive(values, out))
    136         else:
    137             check_status(pandas_masked_to_primitive(values, mask, out))

/Users/Davies/anaconda/lib/python2.7/site-packages/feather/ext.pyx in feather.ext.check_status (feather/ext.cpp:1546)()
     52 
     53     cdef string c_message = status.ToString()
---> 54     raise FeatherError(frombytes(c_message))
     55 
     56 set_numpy_nan(np.nan)

FeatherError: Invalid: unsupported type 9

from feather.

wesm avatar wesm commented on June 18, 2024

I was able to reproduce the issue and fix it. Will push out a new PyPI release as soon as the Travis build finishes

from feather.

jd155 avatar jd155 commented on June 18, 2024

Thanks. I'm using feather multiple times a day now. Really grateful for it!

from feather.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.