From 2ac62f859764eaf213273c7ccc04913da1960746 Mon Sep 17 00:00:00 2001 From: SukeshSrinivas <123338848+SukeshSrinivas@users.noreply.github.com> Date: Thu, 6 Mar 2025 19:07:53 -0600 Subject: [PATCH 1/2] Done --- Problem 1 Article Views 1.py | 0 Problem 2 Invalid Tweets.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Problem 1 Article Views 1.py create mode 100644 Problem 2 Invalid Tweets.py diff --git a/Problem 1 Article Views 1.py b/Problem 1 Article Views 1.py new file mode 100644 index 0000000..e69de29 diff --git a/Problem 2 Invalid Tweets.py b/Problem 2 Invalid Tweets.py new file mode 100644 index 0000000..e69de29 From fcc7ab016ab52a515ea5370384f22745340c4eb4 Mon Sep 17 00:00:00 2001 From: SukeshSrinivas <123338848+SukeshSrinivas@users.noreply.github.com> Date: Thu, 6 Mar 2025 19:09:44 -0600 Subject: [PATCH 2/2] Done --- Problem 1 Article Views 1.py | 12 ++++++++++++ Problem 2 Invalid Tweets.py | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/Problem 1 Article Views 1.py b/Problem 1 Article Views 1.py index e69de29..2be8de5 100644 --- a/Problem 1 Article Views 1.py +++ b/Problem 1 Article Views 1.py @@ -0,0 +1,12 @@ +import pandas as pd + +def article_views(views: pd.DataFrame) -> pd.DataFrame: + return ( + views[views['author_id'] == views['viewer_id']] + .drop_duplicates(subset=['author_id']) + .rename(columns={'author_id': 'id'})[['id']] + .sort_values(by='id', ascending=True, ignore_index=True) + ) + + +#Method 2: \ No newline at end of file diff --git a/Problem 2 Invalid Tweets.py b/Problem 2 Invalid Tweets.py index e69de29..f7a218e 100644 --- a/Problem 2 Invalid Tweets.py +++ b/Problem 2 Invalid Tweets.py @@ -0,0 +1,6 @@ +import pandas as pd + +def invalid_tweets(tweets: pd.DataFrame) -> pd.DataFrame: + return ( + tweets[tweets['content'].apply(lambda x:len(x)>15)][['tweet_id']] + ) \ No newline at end of file