Write a DataFrame to the ORC format.
Added in version 1.5.0.
If a string, it will be used as Root Directory path when writing a partitioned dataset. By file-like object, we refer to objects with a write() method, such as a file handle (e.g. via builtin open function). If path is None, a bytes object is returned.
ORC library to use.
If True
, include the dataframeâs index(es) in the file output. If False
, they will not be written to the file. If None
, similar to infer
the dataframeâs index(es) will be saved. However, instead of being saved as values, the RangeIndex will be stored as a range in the metadata so it doesnât require much space and is faster. Other indexes will be included as columns in the file output.
Additional keyword arguments passed to pyarrow.orc.write_table()
.
Dtype of one or more columns is category, unsigned integers, interval, period or sparse.
engine is not pyarrow.
Notes
Before using this function you should read the user guide about ORC and install optional dependencies.
This function requires pyarrow library.
For supported dtypes please refer to supported ORC features in Arrow.
Currently timezones in datetime columns are not preserved when a dataframe is converted into ORC files.
Examples
>>> df = pd.DataFrame(data={'col1': [1, 2], 'col2': [4, 3]}) >>> df.to_orc('df.orc') >>> pd.read_orc('df.orc') col1 col2 0 1 4 1 2 3
If you want to get a buffer to the orc content you can write it to io.BytesIO
>>> import io >>> b = io.BytesIO(df.to_orc()) >>> b.seek(0) 0 >>> content = b.read()
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4