import datatable as dt
# load a CSV file
df = dt.fread("mydata.csv")
# print the first 10 rows
print(df.head(10))
# select a subset of columns
df_sub = df[:, ["col1", "col2"]]
# filter rows based on a condition
df_filtered = df[df["col1"] > 10]
# group by a column and compute the mean of another column
df_grouped = df[:, {"mean_col2": dt.mean(dt.f.col2)}, dt.by("col1")]
# join two tables on a common column
df2 = dt.fread("mydata2.csv")
df_joined = df[:, :, dt.join(df2, "common_col")]
# write the result to a new CSV file
df_joined.to_csv("result.csv")