El Fubu

Welcome to a low in KB page (Except for Video Thumbnails)

Pyspark and UDF types problem - 2020-11-02 12:20:05

Hello!

Here is a fast note that might not be obvious. Beware with UDF types in PySpark.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from pyspark.sql.functions import udf
from pyspark.sql.types import IntegerType, FloatType


def very_fun(idk):
    return(22)
    
def floating_fun(idk):
    return(22.0)

df = sqlContext.createDataFrame(
    [
        (1, 'foo'), 
        (2, 'bar'),
    ],
    ['id', 'txt'] 
)
    
funfun_int = udf(very_fun, IntegerType())
funfun_float = udf(very_fun, FloatType())
    
floatingfun_int = udf(floating_fun, IntegerType())
floatingfun_float = udf(floating_fun, FloatType())

df = df.withColumn('funfun_int', funfun_int(df['id']))
df = df.withColumn('funfun_float', funfun_float(df['id']))

df = df.withColumn('floatingfun_int', floatingfun_int(df['id']))
df = df.withColumn('floatingfun_float', floatingfun_float(df['id']))

df.show()

And the result is not very amusing:

P-model - Spitirus - 2020-05-22 08:52:37

Oh Spiritus! Oh SPIiiiiiiiIIIIIIIIIiIiiiiiiiiiiiritussssssssssss!

Osamu Sato - Transmigration - 2020-03-06 11:58:37

Lately I have been only posting music. We’ll, that’s what I like to do at the moment, so… ¯_(ツ)_/¯

This time I bring you Osamu Sato’s Transmigration. It’s a weird album mixing pseudo-futuristic sound with strange folk chants. I haven’t played through all the Osamu Sato’s Tong-Nou, a superb weird experience into his mind made into a game, however the first song is clearly the opening theme.

I hope you enjoy. Also give a chance to that game while thinking on Buddhist concepts like samsara (mind those 30 days you get offered to get your soul back).

Kiki Vivi Lily - 80denier - 2020-02-19 11:28:10

Lately this blog is only about music… 🤔

Today we have Kiki Vivi Lily. Yes the name is a bit weird, but her music is pretty good and full of a chill feeling.

I hope you like it!

Denki Groove - ピエール瀧の体操42歳 - 2020-02-07 09:03:49

Today we have Denki Groove in the menu with their 42 year old Pierre gimnastics. Probably one of the most eccentric and well done videos that I have ever seen. Wait until the song gets dramatic :).

Enjoy!