问题标签 [pandas-udf]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
47 浏览

apache-spark - PySpark UDF 到 Pandas UDF 用于 sting 列

我确实有一个对于大型数据集来说很慢的 UDF,我尝试通过利用pandas_udfs来提高执行时间和可扩展性,所有搜索和官方文档都更加关注我已经使用的标量和映射方法,但我确实未能扩展到系列或熊猫数据框方法,你能指出我正确的方向吗?

我确实想并行执行,并且当前的 UDF 方法非常慢,因为按顺序执行记录,而我确实拥有的其他解决方案在 koalas 中,但我宁愿将其作为 pyspark 管道中自定义转换器的一部分包含在内:

下面列出的UDF方法(工作一种):

我尝试了以下但没有映射到系列输入和输出......所以输入向量和输出向量有不同的大小......:

0 投票
0 回答
13 浏览

python - 处理 pandas udf 中的 try-except 子句

我正在尝试迁移一些 udf 函数以提高某些进程对 pandas udf 的性能,但我不知道如何处理异常。

原始功能

我的尝试之一

try 子句有效,但发生异常时失败。我也尝试过(系列迭代器到系列迭代器),但我仍然收到错误

0 投票
0 回答
12 浏览

apache-spark - Pandas UDF for pyspark - Package not found error

I am using the pandas UDF approach to scale my models. However, I am getting an error with the pmdarima package not found. The code works fine till I run it on my notebook on the pandas dataframe itself. So the package is available for use in the notebook. From few answers online, the error seems in package not being available on the worker nodes where the code is trying to parallelize. Can someone help on how to resolve this? How can I also install the package on my worker nodes, if that's the case.

FYI - I am working on Azure Databricks.