Skip to content

Commit

Permalink
Monkeypatch PandasArray class (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
nx10 authored Feb 14, 2024
1 parent c8cb4bc commit a15a1aa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion elbow/dtypes/_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import numpy as np
import pyarrow as pa
from pandas.api.extensions import register_extension_dtype
from pandas.core.arrays import PandasArray

from ._pandas_array import PandasArray
from .base import PaExtensionArray, PaExtensionScalar, PaExtensionType, PdExtensionDtype

__all__ = [
Expand Down
2 changes: 1 addition & 1 deletion elbow/dtypes/_ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import numpy as np
import pyarrow as pa
from pandas.api.extensions import register_extension_dtype
from pandas.core.arrays import PandasArray

from ._pandas_array import PandasArray
from .base import PaExtensionArray, PaExtensionScalar, PaExtensionType, PdExtensionDtype

__all__ = [
Expand Down
13 changes: 13 additions & 0 deletions elbow/dtypes/_pandas_array.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""Monkeypatch PandasArray class.
Pandas 2.x renamed and moved the PandasArray class.
"""

try:
# Pandas >= 2.x
from pandas.arrays import NumpyExtensionArray as PandasArray
except ImportError:
# Pandas < 2.0
from pandas.core.arrays import PandasArray

__all__ = ["PandasArray"]
2 changes: 1 addition & 1 deletion elbow/dtypes/_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import numpy as np
import pyarrow as pa
from pandas.api.extensions import register_extension_dtype
from pandas.core.arrays import PandasArray

from ._pandas_array import PandasArray
from .base import PaExtensionArray, PaExtensionScalar, PaExtensionType, PdExtensionDtype

__all__ = [
Expand Down

0 comments on commit a15a1aa

Please sign in to comment.