import pandas as pd
df = pd.read_csv('hw6_data_sentiment.csv')
from tabulate import tabulate
df = hw6
def shorten(long_string):
return long_string[:1] if len(long_string) < 21 else long_string[:20]
def df_for_tabulate(df, column):
pretty_df = df.copy()
pretty_df[column] = pretty_df.apply(lambda x: shorten(x[column]), axis = 1)
return pretty_df
tabulate_df = df_for_tabulate(df, 0)
print(tabulate(tabulate_df[:10], tablefmt="simple", headers=tabulate_df.columns))
# KAGGLE 0.58792
# HOLDOUT 0.6236864026656415