Feather doesn't support a dataframe column of datetime.date objects in Python
See original GitHub issueI tried writing out a pandas dataframe to feather, and noticed that my column of datetime.date objects was producing the following error:
FeatherError Traceback (most recent call last)
<ipython-input-16-b9e7dd094217> in <module>()
----> 1 feather.write_dataframe(df, 'df.feather')
/Users/matthew/anaconda/lib/python2.7/site-packages/feather/api.pyc in write_dataframe(df, path)
35 name = str(name)
36
---> 37 writer.write_array(name, col)
38
39 writer.close()
/Users/matthew/anaconda/lib/python2.7/site-packages/feather/ext.pyx in feather.ext.FeatherWriter.write_array (feather/ext.cpp:2127)()
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/matthew/anaconda/lib/python2.7/site-packages/feather/ext.pyx in feather.ext.FeatherWriter.write_primitive (feather/ext.cpp:2432)()
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/matthew/anaconda/lib/python2.7/site-packages/feather/ext.pyx in feather.ext.FeatherWriter.write_ndarray (feather/ext.cpp:2739)()
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/matthew/anaconda/lib/python2.7/site-packages/feather/ext.pyx in feather.ext.check_status (feather/ext.cpp:1543)()
52
53 cdef string c_message = status.ToString()
---> 54 raise FeatherError(frombytes(c_message))
55
56 set_numpy_nan(np.nan)
FeatherError: Invalid: unhandled python type, index 0
I’m going to look to using pandas timestamps in the interim.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:13 (6 by maintainers)
Top Results From Across the Web
pandas data format to preserve DateTimeIndex - Stack Overflow
Feather defines its own simplified schemas and metadata for on-disk representation. Feather currently supports the following column types: A ...
Read more >Pandas for time series data — tricks and tips - Adrian G
Split a dataframe based on a date in a datetime column ... Calculate a delta between datetimes in rows (assuming index is datetime)...
Read more >Working with datetime in Pandas DataFrame | by B. Chen
In this article, we will cover the following common datetime problems and should help you get started with data analysis. Convert strings to ......
Read more >Super Fast Cross-Platform Data I/O with Feather - Robot Wealth
Here I've created a pandas data frame with one million rows and ten columns. Here's how long it took to write that data...
Read more >Time series / date functionality — pandas 1.5.2 documentation
pandas supports converting integer or float epoch times to Timestamp and DatetimeIndex . The default unit is nanoseconds, since that is how Timestamp...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is supported in Feather V2 (coming in pyarrow / Arrow 0.17.0)
Experiencing similar pain with this issue. In my case I’m processing a large file using R, writing the result to a feather file and trying to read the file using Python. The dataset contains a Date type column which is generating an error when I try to read the file in Python (but not in R).
R Code
Python Code
Error Message