Skip to content

Commit

Permalink
feat(pyarrow): add pyarrow suppport
Browse files Browse the repository at this point in the history
This enables writing ladybug dataframes to parquet

close #2
  • Loading branch information
AntoineDao committed Jul 5, 2020
1 parent a17b1f4 commit 2dd2f91
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ladybug_pandas/extension_types/arraytype.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ def _maybe_convert(arr):

class LadybugArrayType(ExtensionArray, LadybugExtensionScalarOpsMixin):

# _dtype = LadybugDtype()
_dtype = LadybugDType()

def __init__(self, values, dtype=None, copy=False):
Expand Down Expand Up @@ -396,6 +395,11 @@ def __getitem__(self, item):

return view

def __arrow_array__(self, type=None):
# convert the underlying array values to a pyarrow Array
import pyarrow as pa
return pa.array(self.data, type=pa.float64())


def __len__(self) -> int:
"""
Expand Down Expand Up @@ -774,4 +778,4 @@ def astype(self, dtype, copy=True):


LadybugArrayType._add_arithmetic_ops()
LadybugArrayType._add_comparison_ops()
LadybugArrayType._add_comparison_ops()
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
url="https://github.com/ladybug-tools/ladybug-pandas",
packages=setuptools.find_packages(exclude=["tests"]),
install_requires=requirements,
extras_require={
'arrow': ['pyarrow']
},
classifiers=[
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: Implementation :: CPython",
Expand Down

0 comments on commit 2dd2f91

Please sign in to comment.