Skip to content

Instantly share code, notes, and snippets.

def get_fizz_buzz(number):
for num in range(number+1):
string = ""
if num % 3 == 0:
string = string + "Fizz"
if num % 5 == 0:
string = string + "Buzz"
if num % 5 != 0 and num % 3 != 0:
string = string + str(num)
print(string)
@akhilanandbv003
akhilanandbv003 / customer.txt
Created February 25, 2019 04:50
Customer dataframe
scala> val customer = sc.parallelize(Seq((101,"Jon") , (102,"Aron") ,(103,"Sam"))).toDF("customerId", "name")
customer: org.apache.spark.sql.DataFrame = [customerId: int, name: string]
scala> customer.show
+----------+----+
|customerId|name|
+----------+----+
| 101| Jon|
| 102|Aron|
| 103| Sam|
@akhilanandbv003
akhilanandbv003 / payment.txt
Last active February 25, 2019 04:51
payment Dataframe
scala> val payment = sc.parallelize(Seq(
| (1, 101,2500), (2,102,1110), (3,103,500), (4 ,104,400), (5 ,105, 150), (6 ,106, 450)
| )).toDF("paymentId", "customerId","amount")
payment: org.apache.spark.sql.DataFrame = [paymentId: int, customerId: int ... 1 more field]
scala> payment.show
+---------+----------+------+
|paymentId|customerId|amount|
+---------+----------+------+
| 1| 101| 2500|