Skip to content

Commit 46653aa

Browse files
committed
Add further compatibility support and tests for matplotlib, seaborn, and statsmodels
1 parent a7401da commit 46653aa

8 files changed

Lines changed: 860 additions & 62 deletions

datamatrix/_datamatrix/_basecolumn.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,3 +1044,6 @@ def __rpow__(self, other):
10441044
def __matmul__(self, other):
10451045
return self._map(other)
10461046

1047+
def __dataframe__(self):
1048+
import pandas as pd
1049+
return pd.Series(self)

datamatrix/_datamatrix/_dataframe_compat.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,14 @@ class DataFrameCompatMixin:
219219
''')
220220
result = compare_classes(DataMatrix, pd.DataFrame)
221221
result['iterrows'] = 'function'
222+
result['index'] = 'property'
222223
result['__dataframe__'] = 'function'
223224
for attr, attr_type in result.items():
224225
file.write(f" {attr} = df_compat_{attr_type}('{attr}')\n")
225226
file.write(f'''
226227
class SeriesCompatMixin:
227228
''')
228229
result = compare_classes(BaseColumn, pd.Series)
230+
result['index'] = 'property'
229231
for attr, attr_type in result.items():
230232
file.write(f" {attr} = df_compat_{attr_type}('{attr}')\n")

datamatrix/_datamatrix/_dataframe_compat_mixin.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ class DataFrameCompatMixin:
202202
where = df_compat_function('where')
203203
xs = df_compat_function('xs')
204204
iterrows = df_compat_function('iterrows')
205+
index = df_compat_property('index')
205206
__dataframe__ = df_compat_function('__dataframe__')
206207

207208
class SeriesCompatMixin:
@@ -402,3 +403,4 @@ class SeriesCompatMixin:
402403
view = df_compat_function('view')
403404
where = df_compat_function('where')
404405
xs = df_compat_function('xs')
406+
index = df_compat_property('index')

0 commit comments

Comments
 (0)