Skip to content

Instantly share code, notes, and snippets.

View GermanCM's full-sized avatar

Germán Martínez GermanCM

View GitHub Profile
@GermanCM
GermanCM / gist:2451b420b8f8313f92830bfc4b98bfa8
Created March 26, 2020 16:56 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@GermanCM
GermanCM / pyspark-split-dataframe-column-literal.py
Created March 8, 2019 09:16 — forked from ayee/pyspark-split-dataframe-column-literal.py
Split Spark dataframe columns with literal
from pyspark.sql.functions import split
df = sc.parallelize([[1, 'Foo:10'], [2, 'Bar:11'], [3,'Car:12']]).toDF(['Event', 'eventtype'])
df = df.withColumn('Thing', split(df.eventtype, ':')[0])
df = df.withColumn('Ranking', split(df.eventtype, ':')[1])
df.collect()
# [Row(Event=1, eventtype=u'Foo:10', Thing=u'Foo', Ranking=u'10'),
# Row(Event=2, eventtype=u'Bar:11', Thing=u'Bar', Ranking=u'11'),
# Row(Event=3, eventtype=u'Car:12', Thing=u'Car', Ranking=u'12')]