DataFrame 显示字符串表示失败,showString(Integer, Boolean, Boolean) 不存在
DataFrame show string representation fails with showString(Integer, Boolean, Boolean) does not exist
我正在尝试按照建议 捕获由 show()
函数生成的字符串表示形式,但似乎 showString
方法不再是 public .
logger.info('\n{}'.format(raw_data._jdf.showString(20, False, False)))
正在返回以下错误跟踪
Traceback (most recent call last):
File "xxxxxxxx/SparkTest/main.py", line 63, in <module>
logger.info('\n{}\n'.format(raw_data._jdf.showString(20, False, False)))
File "xxxxxxxx/envs/SparkTest/lib/python3.8/site-packages/py4j/java_gateway.py", line 1304, in __call__
return_value = get_return_value(
File "xxxxxxxx/envs/SparkTest/lib/python3.8/site-packages/pyspark/sql/utils.py", line 128, in deco
return f(*a, **kw)
File "xxxxxxxx/envs/SparkTest/lib/python3.8/site-packages/py4j/protocol.py", line 330, in get_return_value
raise Py4JError(
py4j.protocol.Py4JError: An error occurred while calling o45.showString. Trace:
py4j.Py4JException: Method showString([class java.lang.Integer, class java.lang.Boolean, class java.lang.Boolean]) does not exist
at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318)
at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:326)
at py4j.Gateway.invoke(Gateway.java:274)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.base/java.lang.Thread.run(Thread.java:832)
这种方法还有其他替代方法吗?
错误提示方法showString(Integer, Boolean, Boolean)
不存在。如果您查看 showString
源代码,它会将 Integer
作为第二个参数,但您传递的是 boolean
.
你想设置 truncate=False
所以只需在第二个参数中传递 0:
logger.info('\n{}'.format(raw_data._jdf.showString(20, 0, False)))
我正在尝试按照建议 show()
函数生成的字符串表示形式,但似乎 showString
方法不再是 public .
logger.info('\n{}'.format(raw_data._jdf.showString(20, False, False)))
正在返回以下错误跟踪
Traceback (most recent call last):
File "xxxxxxxx/SparkTest/main.py", line 63, in <module>
logger.info('\n{}\n'.format(raw_data._jdf.showString(20, False, False)))
File "xxxxxxxx/envs/SparkTest/lib/python3.8/site-packages/py4j/java_gateway.py", line 1304, in __call__
return_value = get_return_value(
File "xxxxxxxx/envs/SparkTest/lib/python3.8/site-packages/pyspark/sql/utils.py", line 128, in deco
return f(*a, **kw)
File "xxxxxxxx/envs/SparkTest/lib/python3.8/site-packages/py4j/protocol.py", line 330, in get_return_value
raise Py4JError(
py4j.protocol.Py4JError: An error occurred while calling o45.showString. Trace:
py4j.Py4JException: Method showString([class java.lang.Integer, class java.lang.Boolean, class java.lang.Boolean]) does not exist
at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:318)
at py4j.reflection.ReflectionEngine.getMethod(ReflectionEngine.java:326)
at py4j.Gateway.invoke(Gateway.java:274)
at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
at py4j.commands.CallCommand.execute(CallCommand.java:79)
at py4j.GatewayConnection.run(GatewayConnection.java:238)
at java.base/java.lang.Thread.run(Thread.java:832)
这种方法还有其他替代方法吗?
错误提示方法showString(Integer, Boolean, Boolean)
不存在。如果您查看 showString
源代码,它会将 Integer
作为第二个参数,但您传递的是 boolean
.
你想设置 truncate=False
所以只需在第二个参数中传递 0:
logger.info('\n{}'.format(raw_data._jdf.showString(20, 0, False)))