We are currently integrating Narwhals into TemporalScope, an explainable AI (XAI) library designed for temporal feature importance analysis. Narwhals serves as the backend for supporting multiple DataFrame implementations (e.g., Pandas, Polars, Modin) in a unified, backend-agnostic manner.
During this integration, we encountered a TypeError when performing a row count operation. Specifically, when attempting to cast the result of count() to "int64" using Narwhals' backend-agnostic API in the _get_row_count method, the following error is raised:
TypeError: issubclass() arg 1 must be a class
This issue affects TemporalScope's SingleStepTargetShifter, which is responsible for shifting target variables in time series data as part of its fit/transform workflow. The error prevents proper row counting and disrupts TemporalScope's compatibility with Narwhals. It occurs consistently across all tested backends (e.g., Pandas, Modin, Polars).
Describe the bug
We are currently integrating Narwhals into TemporalScope, an explainable AI (XAI) library designed for temporal feature importance analysis. Narwhals serves as the backend for supporting multiple DataFrame implementations (e.g., Pandas, Polars, Modin) in a unified, backend-agnostic manner.
During this integration, we encountered a
TypeError
when performing a row count operation. Specifically, when attempting to cast the result ofcount()
to"int64"
using Narwhals' backend-agnostic API in the_get_row_count
method, the following error is raised:TypeError: issubclass() arg 1 must be a class
This issue affects TemporalScope's
SingleStepTargetShifter
, which is responsible for shifting target variables in time series data as part of its fit/transform workflow. The error prevents proper row counting and disrupts TemporalScope's compatibility with Narwhals. It occurs consistently across all tested backends (e.g., Pandas, Modin, Polars).Steps or code to reproduce the bug
To reproduce the issue, follow these steps:
TypeError
raised during the casting step.Code to reproduce:
Expected results
The row count operation should complete successfully, returning the number of rows cast to "int64". No error should occur.
Example expected output:
Actual results
The following error is raised during the execution of the row count operation:
Please Run
narwhals.show_version()
Relevant log output