smcrone commited on
Commit
56fd811
1 Parent(s): a67e411

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -105,7 +105,6 @@ def dataframe_preprocessing(df_to_preprocess:pd.DataFrame):
105
  df_to_preprocess[feature] = df_to_preprocess[feature].replace('\n', ' ', regex=True).replace('\r', '', regex=True)
106
  # Renaming columns (for greater model intelligibility).
107
  df_to_preprocess.rename(columns={"userverified": "user is verified",
108
- "userurl": "user has url",
109
  "userdescription": "user description",
110
  "usercreated_at": "user created at",
111
  "followers_count": "followers count",
@@ -113,8 +112,6 @@ def dataframe_preprocessing(df_to_preprocess:pd.DataFrame):
113
  "tweet_count": "tweet count",
114
  "userlocation": "user location"},
115
  inplace=True)
116
- # Making URL column binary.
117
- df_to_preprocess['user has url'].replace({'_URL_': 'True', "": 'False'}, inplace=True)
118
  # Adding some extra features.
119
  df_to_preprocess['years since account created'] = df_to_preprocess['created_at'].dt.year.astype('Int64') - df_to_preprocess['user created at'].dt.year.astype('Int64')
120
  df_to_preprocess['tweets per day'] = df_to_preprocess['tweet count']/((df_to_preprocess['created_at'] - df_to_preprocess['user created at']).dt.days)
@@ -257,7 +254,7 @@ def get_user_tweets(user_id:str, days_to_go_back:int, client:tw.Client):
257
  start_time='{}-{}-{}T{}:00:00Z'.format(year,month,day,hour),
258
  tweet_fields=['author_id','created_at','public_metrics','source'],
259
  until_id=None,
260
- user_fields=['created_at','description','location','public_metrics','url','verified'],
261
  user_auth=False,
262
  limit=500)
263
  except:
@@ -353,7 +350,7 @@ def on_receipt_of_tweet_query(request:str,client:tw.Client):
353
  place_fields=None,
354
  poll_fields=None,
355
  tweet_fields=['author_id','created_at','public_metrics','source'],
356
- user_fields=['created_at','description','location','public_metrics','url','verified'],
357
  user_auth=False)
358
 
359
  # STAGE 2. PREPROCESSING OF TWEET DATA
 
105
  df_to_preprocess[feature] = df_to_preprocess[feature].replace('\n', ' ', regex=True).replace('\r', '', regex=True)
106
  # Renaming columns (for greater model intelligibility).
107
  df_to_preprocess.rename(columns={"userverified": "user is verified",
 
108
  "userdescription": "user description",
109
  "usercreated_at": "user created at",
110
  "followers_count": "followers count",
 
112
  "tweet_count": "tweet count",
113
  "userlocation": "user location"},
114
  inplace=True)
 
 
115
  # Adding some extra features.
116
  df_to_preprocess['years since account created'] = df_to_preprocess['created_at'].dt.year.astype('Int64') - df_to_preprocess['user created at'].dt.year.astype('Int64')
117
  df_to_preprocess['tweets per day'] = df_to_preprocess['tweet count']/((df_to_preprocess['created_at'] - df_to_preprocess['user created at']).dt.days)
 
254
  start_time='{}-{}-{}T{}:00:00Z'.format(year,month,day,hour),
255
  tweet_fields=['author_id','created_at','public_metrics','source'],
256
  until_id=None,
257
+ user_fields=['created_at','description','location','public_metrics','verified'],
258
  user_auth=False,
259
  limit=500)
260
  except:
 
350
  place_fields=None,
351
  poll_fields=None,
352
  tweet_fields=['author_id','created_at','public_metrics','source'],
353
+ user_fields=['created_at','description','location','public_metrics','verified'],
354
  user_auth=False)
355
 
356
  # STAGE 2. PREPROCESSING OF TWEET DATA