pyspark适合对象的酸洗错误

时间:2018-07-19 10:02:17

标签: python-3.x pyspark pickle

我在下面的代码中收到以下错误。如果有人可以帮助我了解错误是什么以及如何可以绕过错误,那就太好了

charcols = [item[0] for item in training_data.dtypes if item[1].endswith('string')]
Indexer = StringIndexer(inputCol = charcols[0], outputCol=charcols[0]+ "indexed", handleInvalid="skip")
indexer_fit = Indexer.fit(training_data)
training_data = indexer_fit.transform(training_data)
dmp = pickle.dumps(indexer_fit)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.4-src.zip/py4j/java_gateway.py", line 1133, in __call__
  File "/usr/hdp/current/spark2-client/python/pyspark/sql/utils.py", line 63, in deco
    return f(*a, **kw)
File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.4-src.zip/py4j/protocol.py", line 323, in get_return_value
py4j.protocol.Py4JError: An error occurred while calling o59.__getstate__. Trace:
py4j.Py4JException: Method __getstate__([]) 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:272)
        at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:132)
        at py4j.commands.CallCommand.execute(CallCommand.java:79)
        at py4j.GatewayConnection.run(GatewayConnection.java:214)
        at java.lang.Thread.run(Thread.java:748)

0 个答案:

没有答案