本文整理汇总了Python中pyspark.sql.dataframe.DataFrame._h2o_frame方法的典型用法代码示例。如果您正苦于以下问题:Python DataFrame._h2o_frame方法的具体用法?Python DataFrame._h2o_frame怎么用?Python DataFrame._h2o_frame使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyspark.sql.dataframe.DataFrame
的用法示例。
在下文中一共展示了DataFrame._h2o_frame方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: as_spark_frame
# 需要导入模块: from pyspark.sql.dataframe import DataFrame [as 别名]
# 或者: from pyspark.sql.dataframe.DataFrame import _h2o_frame [as 别名]
def as_spark_frame(self, h2o_frame, copy_metadata=True):
"""
Transforms given H2OFrame to Spark DataFrame
Parameters
----------
h2o_frame : H2OFrame
copy_metadata: Bool = True
Returns
-------
Spark DataFrame
"""
if isinstance(h2o_frame, H2OFrame):
j_h2o_frame = h2o_frame.get_java_h2o_frame()
jdf = self._jhc.asDataFrame(j_h2o_frame, copy_metadata)
df = DataFrame(jdf, self._sql_context)
# Attach h2o_frame to dataframe which forces python not to delete the frame when we leave the scope of this
# method.
# Without this, after leaving this method python would garbage collect the frame since it's not used
# anywhere and spark. when executing any action on this dataframe, will fail since the frame
# would be missing.
df._h2o_frame = h2o_frame
return df