This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Databricks notebook source | |
# Write a pyspark code to identify 𝒕𝒉𝒆 𝑯𝒊𝒈𝒉𝒆𝒔𝒕 & 𝑳𝒐𝒘𝒆𝒔𝒕 𝑺𝒂𝒍𝒂𝒓𝒊𝒆𝒅 𝑬𝒎𝒑𝒍𝒐𝒚𝒆𝒆 𝒊𝒏 𝒆𝒂𝒄𝒉 𝑫𝒆𝒑𝒂𝒓𝒕𝒎𝒆𝒏𝒕. | |
# COMMAND ---------- | |
from pyspark.sql import SparkSession | |
from pyspark.sql.functions import min,max,col,rank,desc | |
from pyspark.sql.window import Window |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# COMMAND ---------- | |
from pyspark.sql import SparkSession | |
from pyspark.sql.functions import lead,lag,round | |
from pyspark.sql.functions import col | |
from pyspark.sql.window import Window | |
from pyspark.sql.types import * | |
# COMMAND ---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"name": "John Doe", | |
"age": 30, | |
"email": "john@example.com", | |
"address": { | |
"street": "123 Main Street", | |
"city": "New York", | |
"zipcode": "10001" | |
}, | |
"phones": [{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "data": [ | |
{ | |
"MainId": 1111, | |
"firstName": "bunny", | |
"lastName": "dgr8", | |
"categories": [ | |
{ | |
"CategoryID": 1, | |
"CategoryName": "Example" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Databricks notebook source | |
s="sai is a good boy sai is working in SG sai is a DE guy he has a pet called rocky he is having two laptops." | |
# COMMAND ---------- | |
words_split=s.split(" ") | |
print(words_split) | |
letters_split=[] | |
letters_split[:]=s[:] | |
print(letters_split) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Databricks notebook source | |
from pyspark.sql import SparkSession | |
from pyspark.sql.functions import * | |
from pyspark.sql.types import * | |
from pyspark.sql import Window | |
# COMMAND ---------- | |
spark=SparkSession.builder.appName("Joining two tables Vetrically when no common column is invovled").getOrCreate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s=input(str()) | |
def a_b_occurence_check(s): | |
s1=[] | |
s1[:]=s | |
#s1 | |
s1_a=[] | |
for i in range(0,len(s1)): | |
if s1[i]=='a': | |
s1_a.append(i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Databricks notebook source | |
## input | |
""" | |
{"id":"1","Name":"Sai"Ram","City":"Hyderabad"} | |
{"id":"2","Name":"Avi"nash","City":"Bihar"} | |
{"id":"3","Name":"Di"nesh","City":"Kurool"} | |
{"id":"4","Name":"Pramod"Kumar","City":"Mathura"} | |
#### output | |
{"id":"1","Name":"SaiRam","City":"Hyderabad"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark.sql import SparkSession | |
from pyspark.sql.types import * | |
from pyspark.sql.functions import * | |
from pyspark.sql.window import * | |
spark=SparkSession.builder.appName("Sai-working-calculating-the-salary-credit-of-an-each-employee-with-their-attendance-using-Pyspark").getOrCreate() | |
Users = [("James","","Smith","36636","M",30000,{"22/06/2022":"leave","23/06/2022":"present"}), | |
("Michael","Rose","","40288","M",3000,{"22/06/2022":"present","23/06/2022":"leave"}), | |
("Robert","","Williams","42114","M",40000,{"22/06/2022":"present","23/06/2022":"present"}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Input the binary code of 1's and 0's") | |
s=input(str()) | |
print("Please press 1 or 0 to get their biggest series") | |
choose=input(str()) | |
list_s=[] | |
list_1=[] | |
list_2=[] | |
for i_1 in s: | |
list_s.append(i_1) | |
list_s_index=[] |
NewerOlder