Skip to content

Commit 76232df

Browse files
committed
added some thoughts, currently going in circles
1 parent 90ad973 commit 76232df

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

narwhals/_polars/dataframe.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@
9595

9696
NativePolarsFrame = TypeVar("NativePolarsFrame", pl.DataFrame, pl.LazyFrame)
9797

98+
# @mp: can we make a class here which is more generic than all the other framework specif frames?
99+
# then have the other frames inherit from this, but it should be generic enough that we can use
100+
# it also to read plugins?
101+
98102

99103
class PolarsBaseFrame(Generic[NativePolarsFrame]):
100104
drop_nulls: Method[Self]

narwhals/translate.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,13 @@ def _from_native_impl( # noqa: C901, PLR0911, PLR0912, PLR0915
506506
raise TypeError(msg)
507507
return native_object
508508
return ns_spark.compliant.from_native(native_object).to_narwhals()
509+
510+
'''
511+
@mp: need function here which can read frames as long as they're of the type provided
512+
in the plugins. that could then be called below
513+
how to make it generic enough but not so generic as to break downsteam..
514+
'''
515+
509516

510517
# Interchange protocol
511518
if _supports_dataframe_interchange(native_object):
@@ -549,7 +556,7 @@ def _from_native_impl( # noqa: C901, PLR0911, PLR0912, PLR0915
549556
return df_compliant.to_narwhals()
550557
# @mp: not sure if correct exception, check. Improve error message
551558
except TypeError as e:
552-
print(f"Cannot read it the dataframe, reason {e}. Currently only supporting daft plugins")
559+
print(f"Cannot read in the dataframe, reason {e}. Currently only supporting daft plugins")
553560
# try the next plugin
554561
continue
555562

0 commit comments

Comments
 (0)