[英]from spark dataframe to pandas dataframe
我有一个火花 dataframe 我是通过这种方式创建的:
tx_df = (spark
.read
.parquet("/data/file"))
tx_ecommerce = tx_df.filter(tx_df["POS_Cardholder_Presence"]=="ECommerce").show()
我尝试将 tx_commerce 转换为 pandas dataframe。 我试过这样:
tx_ecommerce.toPandas()
但我得到了这个错误:
-------------------------------------------------- ------------------------- ----> 1 tx_ecommerce.toPandas() 中的 AttributeError Traceback(最近一次调用最后一次)
AttributeError: 'NoneType' object 没有属性 'toPandas'
请帮忙解决这个问题?
谢谢
当您将.show() 放在最后时,它不再是 pyspark 数据帧。
删除它,它应该可以工作。
tx_ecommerce =tx_df.filter(tx_df["POS_Cardholder_Presence"]=="ECommerce")
tx_ecommerce.toPandas()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.