I'm learning spark with python, I came up with this method,
def convert_to_row(d: dict) -> Row:
return Row(**OrderedDict(sorted(d.items())))
this method takes a line and convert into Row
.
can someone simplifies this what are these points mean.
1) d: dict
2) -> Row
3) why is **
there? for kvargs
?
also, if I wrap this into the class, first argument will be self
, something like that.
def convert_to_row(self, d: dict) -> Row:
return Row(**OrderedDict(sorted(d.items())))
will it work the same way as it was doing before?
thanks.