tjl8 commited on
Commit
4022ed9
·
verified ·
1 Parent(s): 082446d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -65,7 +65,8 @@ def fetch_askreddit_posts(limit=100):
65
  'url': post.url,
66
  'num_comments': post.num_comments,
67
  'created_utc': datetime.fromtimestamp(post.created_utc),
68
- 'author': str(post.author)
 
69
  })
70
  return pd.DataFrame(posts)
71
 
@@ -83,6 +84,7 @@ except FileNotFoundError:
83
  # If JSON file is not found, fetch data using PRAW
84
  df = fetch_askreddit_posts()
85
  print("Data fetched from Reddit API.")
 
86
 
87
  #Extract day of week
88
  df['day_of_week'] = df['created_utc'].dt.day_name()
@@ -91,7 +93,7 @@ df['day_of_week']
91
  df['hour_of_day'] = df['created_utc'].dt.hour
92
  df['hour_of_day']
93
 
94
- st.write(df.head())
95
 
96
  # Number of posts vs time of the day
97
 
 
65
  'url': post.url,
66
  'num_comments': post.num_comments,
67
  'created_utc': datetime.fromtimestamp(post.created_utc),
68
+ 'author': str(post.author),
69
+ 'upvote_ratio': post.upvote_ratio
70
  })
71
  return pd.DataFrame(posts)
72
 
 
84
  # If JSON file is not found, fetch data using PRAW
85
  df = fetch_askreddit_posts()
86
  print("Data fetched from Reddit API.")
87
+ st.write(df.head())
88
 
89
  #Extract day of week
90
  df['day_of_week'] = df['created_utc'].dt.day_name()
 
93
  df['hour_of_day'] = df['created_utc'].dt.hour
94
  df['hour_of_day']
95
 
96
+
97
 
98
  # Number of posts vs time of the day
99