示例#1
0
fdf2.show()

# select demo
fdf1["Ename"].show()  # single column
fdf1[["Ename", "Age"]].show()  # multiple column

# filter demo
fdf1[fdf1.Age > 19].show()
fdf1[fdf1.Age > 19 and fdf1.Country == 'Japan'].show()

# sort demo
fdf1.sort("Age", ascending=False).show()  # single column
fdf1.sort(["Age", "Country"]).show()  # multiple column

# groupby demo
fdf1.groupby('Country')['Country'].show()

# merge demo
#currently joining on same key is not supported at frovedis server
#fdf1.merge(fdf2, left_on="Country", right_on="Country").show()

# renaming demo
fdf3 = fdf2.rename({'Country': 'Cname'})
fdf2.show()
fdf3.show()

# join after column renaming
fdf1.merge(fdf3, left_on="Country", right_on="Cname").show()  # with defaults
fdf1.merge(fdf3,
           left_on="Country",
           right_on="Cname",
示例#2
0
# select demo
fdf1["Ename"].show()  # single column
fdf1[["Ename", "Age"]].show()  # multiple column

# filter demo
fdf1[fdf1.Age > 19].show()
fdf1[fdf1.Age > 19 and fdf1.Country == 'Japan'].show()

# sort demo
fdf1.sort("Age", ascending=False).show()  # single column
fdf1.sort(["Age", "Country"]).show()  # multiple column

# groupby demo
fdf1.groupby('Country').agg({
    'Age': ['max', 'min', 'mean'],
    'Ename': ['count']
}).show()

# merge demo
#currently joining on same key is not supported at frovedis server
#fdf1.merge(fdf2, left_on="Country", right_on="Country").show()

# renaming demo
fdf3 = fdf2.rename({'Country': 'Cname'})
fdf2.show()
fdf3.show()

# join after column renaming
fdf1.merge(fdf3, left_on="Country", right_on="Cname").show()  # with defaults
fdf1.merge(fdf3,
           left_on="Country",