Commit b8138ba 1 parent fec5d68 commit b8138ba Copy full SHA for b8138ba
File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,14 @@ def _to_stype(tpe) -> X:
84
84
inner = as_spark_type (tpe .__args__ [0 ])
85
85
return _Series (inner )
86
86
if hasattr (tpe , "__origin__" ) and tpe .__origin__ == ks .DataFrame :
87
- return _DataFrame ([as_spark_type (t ) for t in tpe .__args__ [0 ].__args__ ])
87
+ tuple_type = tpe .__args__ [0 ]
88
+ if hasattr (tuple_type , "__tuple_params__" ):
89
+ # Python 3.5.0 to 3.5.2 has '__tuple_params__' instead.
90
+ # See https://github.com/python/cpython/blob/v3.5.2/Lib/typing.py
91
+ parameters = getattr (tuple_type , "__tuple_params__" )
92
+ else :
93
+ parameters = getattr (tuple_type , "__args__" )
94
+ return _DataFrame ([as_spark_type (t ) for t in parameters ])
88
95
inner = as_spark_type (tpe )
89
96
if inner is None :
90
97
return _Unknown (tpe )
You can’t perform that action at this time.
0 commit comments