-
Notifications
You must be signed in to change notification settings - Fork 358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ExtensionDtypes as type arguments. #2106
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2106 +/- ##
=======================================
Coverage 95.36% 95.37%
=======================================
Files 60 60
Lines 13549 13573 +24
=======================================
+ Hits 12921 12945 +24
Misses 628 628
Continue to review full report at Codecov.
|
self.tpe = types.StructType( | ||
[ | ||
types.StructField(n if n is not None else ("c%s" % i), t) | ||
types.StructField(name_like_string(n) if n is not None else ("c%s" % i), t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix!
new_params.append(new_class) | ||
else: | ||
new_params.append(param.type if isinstance(param, np.dtype) else param) | ||
return Tuple[tuple(new_params)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was confused by the function name at the first sight. It might be helpful to add a docstring or simply annotate the return type.
The PR looks great to me. Thanks! |
Thanks! Let me merge this now. Please feel free to leave comments if any. cc @HyukjinKwon @itholic |
@@ -334,6 +334,12 @@ | |||
|
|||
|
|||
def _create_tuple_for_frame_type(params): | |||
""" | |||
This is a workaround to support variadic generic in DataFrame. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's clear, thanks!
👍 |
Looks all clear to me. Thanks for the work! |
Support
ExtensionDtype
s as type arguments by reusingNameTypeHolder
for DataFrame's type annotation.Also support to infer Spark DataType from the return type annotation with
ExtensionDtype
s.Before:
After: