Thanks Davies and Nathan, I found my error.
I was using *ArrayType()* and I need to pass de kind of type has in this array and I has not passing *ArrayType(IntegerType())*. Thanks :) On Wed, Nov 25, 2015 at 7:46 PM, Davies Liu <dav...@databricks.com> wrote: > It works in master (1.6), what's the version of Spark you have? > > >>> from pyspark.sql.functions import udf > >>> def f(a, b): pass > ... > >>> my_udf = udf(f) > >>> from pyspark.sql.types import * > >>> my_udf = udf(f, IntegerType()) > > > On Wed, Nov 25, 2015 at 12:01 PM, Daniel Lopes <dan...@bankfacil.com.br> > wrote: > > Hallo, > > > > supose I have function in pyspark that > > > > def function(arg1,arg2): > > pass > > > > and > > > > udf_function = udf(function, IntegerType()) > > > > that takes me error > > > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > TypeError: __init__() takes at least 2 arguments (1 given) > > > > > > How I use? > > > > Best, > > > > > > -- > > Daniel Lopes, B.Eng > > Data Scientist - BankFacil > > CREA/SP 5069410560 > > Mob +55 (18) 99764-2733 > > Ph +55 (11) 3522-8009 > > http://about.me/dannyeuu > > > > Av. Nova Independência, 956, São Paulo, SP > > Bairro Brooklin Paulista > > CEP 04570-001 > > https://www.bankfacil.com.br > > > -- *Daniel Lopes, B.Eng* Data Scientist - BankFacil CREA/SP 5069410560 <http://edital.confea.org.br/ConsultaProfissional/cartao.aspx?rnp=2613651334> Mob +55 (18) 99764-2733 <callto:+5518997642733> Ph +55 (11) 3522-8009 http://about.me/dannyeuu Av. Nova Independência, 956, São Paulo, SP Bairro Brooklin Paulista CEP 04570-001 https://www.bankfacil.com.br