我定义了一个类似的函数
getDate = udf(lambda x : to_date(x))
Run Code Online (Sandbox Code Playgroud)
当我使用它时
df.select(getDate("time")).show()
Run Code Online (Sandbox Code Playgroud)
我遇到了
File ".../pyspark/sql/functions.py", in to_date
return Column(sc._jvm.functions.to_date(_to_java_column(col)))
AttributeError: 'NoneType' object has no attribute '_jvm'
Run Code Online (Sandbox Code Playgroud)
这是否意味着我不能pyspark.sql在自己的udf中使用.function?
这不是一个具体的问题,我想知道为什么会这样.
我对这些感到困惑:
我这样写的时候
main = do
putStrLn . printf "%f" $ 2.3
Run Code Online (Sandbox Code Playgroud)
它会导致
没有实例
(PrintfArg a0)从使用所产生的printf类型变量
a0不明确
代码在GHCi中运行良好,当我runhaskell在终端中使用时发生了这个错误.
所以我写
putStrLn . printf "%f" $ (2.3 :: Double)
Run Code Online (Sandbox Code Playgroud)
没关系,但我不知道原因.
不"%f"推断2.3属于类型Double?
据我所知,putStrLn有类型String -> IO(),不能将printf结果转换为何String时2.3不装饰Double?