Beispiel #1
0
# miscellaneous
print "all count: ", fdf1.count()
print  # all column counts
print "min(age): ", fdf1.min("Age")
print
print "max(age): ", fdf1.max("Age")
print
print "sum(age): ", fdf1.sum("Age")
print
print "avg(age): ", fdf1.avg("Age")
print
print "std(age): ", fdf1.std("Age")
print
print "count(age): ", fdf1.count("Age")
print
print(fdf1.describe())
print

# describe demo
data = {
    'one': [10, 12, 13, 15],
    'two': [10.23, 12.20, 34.90, 100.12],
    'three': ['F', 'F', 'D', 'A'],
    'four': [1, 2, 3, 4]
}
pdf = pd.DataFrame(data)
print(pdf.describe())
print
df = FrovedisDataframe(pdf)
print(df.describe())
print  # prints count, mean, std, sum, min, max
Beispiel #2
0
# operation chaining: join -> sort -> select -> show
print ("* chaining: merge two tables, sort by Age, and select Age, Ename and Country")
fdf1.merge(fdf3, left_on="Country", right_on="Cname") \
    .sort("Age")[["Age", "Ename", "Country"]].show()

# column statistics
print ("* column statistics")
print ("min(Age): {}".format(fdf1.min("Age")))
print ("max(Age): {}".format(fdf1.max("Age")))
print ("sum(Age): {}".format(fdf1.sum("Age")))
print ("avg(Age): {}".format(fdf1.avg("Age")))
print ("std(Age): {}".format(fdf1.std("Age")))
print ("count(Age): {}".format(fdf1.count("Age")))
print ("describe: ")
print (fdf1.describe())
print ("\n")

# merging with panda dataframe
print ("* merge with pandas table")
pdf2.rename(columns={'Country' : 'Cname'},inplace=True)
joined = fdf1.merge(pdf2, left_on="Country", right_on="Cname")
joined.show()

# conversion
print ("* convert Frovedis DataFrame to Pandas DataFrame")
print (fdf1.to_panda_dataframe())
print ("\n")

FrovedisServer.shut_down()