This file contains hidden or 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
import org.apache.spark.sql.expressions.Window | |
import org.apache.spark.sql.functions._ | |
val winsales = spark.table("winsales") | |
val windowSpec = Window.orderBy(col("dateid"), col("salesid")).rowsBetween(Window.unboundedPreceding, Window.currentRow) | |
val result = winsales | |
.select(col("salesid"), col("dateid"), col("sellerid"), col("qty"), |
This file contains hidden or 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
a = [1,2,3,4,5,6,7,8,9,'cat'] | |
print(len(a)*2) |
This file contains hidden or 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
a = [1,2,3,4,5,6,7,8,9,'cat'] | |
print(len(a)) |
This file contains hidden or 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
import pandas as pd | |
df = pd.DataFrame(pd.read_csv("Lengthofnationalhighway.csv")) | |
df = df.melt(id_vars=['Loc']) | |
df.to_csv("Lengthofnationalhighwaytwo.csv",index = False) |
This file contains hidden or 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
import pandas as pd | |
marks = {'student x':[10,20,30,40,50,60], | |
'student Y':[80,90,100,10,20,30], | |
'student Z':[40,50,60,70,80,90]} | |
df = pd.DataFrame(marks) #creating DataFrame from dictionary | |
print(df) #printing before renameing | |
df.rename(columns={'student x':'Week_Number'}) |
This file contains hidden or 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
import pandas as pd | |
marks = {'student x':[10,20,30,40,50,60], | |
'student Y':[80,90,100,10,20,30], | |
'student Z':[40,50,60,70,80,90]} | |
print(marks) #printing python dictionary directly | |
pd.DataFrame(marks) #converting it into DataFrame |
This file contains hidden or 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
k = [2,4,4,1,1,7,9,'bela'] |
This file contains hidden or 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
def x(): | |
print("Hello Hey ! ") | |
x() | |
x() |