def main(args): dates = F.get_date_list(args) for i in range(len(dates) - 1): d0, d1 = F.get_dates(i, dates) print("Running for", d0) gt = GetTopics(args, d0) gt.import_data().vectorize().get_best().save_aspects().get_visual() print("Topics for", d0, "found and saved")
def main(args): F.set_up_folders(args) dates = F.get_date_list(args) for i in range(len(dates) - 1): d0, d1 = F.get_dates(i, dates) print("Running for", d0) gt = GetTweets(args, d0, d1) gt.get_tweets().fill_list().save() print("Done", d0, "found", len(gt.all_info), "tweets")
def main(args): dates = F.get_date_list(args) for i in range(len(dates) - 1): d0, d1 = F.get_dates(i, dates) pt = ProcessTweets(args, d0) pt.read_data() \ .get_user() \ .get_islanders() \ .add_dummy_cols() \ .format_time() \ .contains_pic() \ .apply_processing() \ .get_sentiment() \ .weighted_sentiment() \ .save()
def __init__(self, args): self.args = args self.df = F.import_all( os.path.join(args.bucket, "season_" + str(args.season), "processed/")) self.inc_islander() self.agg_df = pd.DataFrame() self.islanders = get_islanders_s(args.season)
def add_cols(self): self.agg_df[ "total_favs"] = self.agg_df["favs"] * self.agg_df["n_tweets"] self.agg_df[ "total_retwe"] = self.agg_df["retwe"] * self.agg_df["n_tweets"] self.agg_df = self.agg_df.merge(F.get_islander_df(self.args.season), on="islander", how="left") self.agg_df["n_days"] = self.agg_df["dumped"] - self.agg_df["arrived"] self.agg_df["n_days"] = np.where( self.agg_df["dumped"] == 0, 60 - self.agg_df["arrived"], self.agg_df["n_days"], ) return self
def inc_islander(self, col="islanders"): self.df[col] = self.df[col].apply(lambda x: F.str_to_list(x)) self.df["inc_islander"] = self.df[col].apply(lambda x: len(x)) self.df["inc_islander"] = np.where(self.df["inc_islander"] < 1, "No", "Yes") return self
def __init__(self, args, d0): self.args = args self.d0 = d0 self.df = None self.islanders = F.get_islanders_s(args.season)