Fix return type in PanderaTransformer::to_python_value()
#2420
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Return an object of the correct type in the
to_python_value
of the pandera type transformer. Currently, the returned type ispandas.core.frame.DataFrame
, but the declared return type ispandera.typing.DataFrame
.I suspect this is because instantiating
pandera.DataFrameSchema
returns the former rather than what one would normally expect, which is the latter (the pandera DataFrame).Closes flyteorg/flyte##5369
Why are the changes needed?
Typeguard is unhappy about Flyte workflows that use Pandera, because the type transformer returns an object of the incorrect type.
What changes were proposed in this pull request?
Simply mark the return type as pandera.typing.DataFrame (which inherits from the currently returned type, so I don't expect any major side-effects).
How was this patch tested?
Created a test workflow, checked with typeguard and everything is now running.
Setup process
Not needed.
Check all the applicable boxes