diff --git a/Problem1_Articles.py b/Problem1_Articles.py new file mode 100644 index 0000000..83090f2 --- /dev/null +++ b/Problem1_Articles.py @@ -0,0 +1,7 @@ +import pandas as pd + +def article_views(views: pd.DataFrame) -> pd.DataFrame: + df=views[views['author_id']==views['viewer_id']] + df.drop_duplicates(subset='author_id',inplace=True) + df.sort_values(by=['author_id'],inplace=True) + return pd.DataFrame(df[['author_id']]).rename(columns={'author_id':'id'}) \ No newline at end of file diff --git a/Problem2_InvalidTweets.py b/Problem2_InvalidTweets.py new file mode 100644 index 0000000..676bb0a --- /dev/null +++ b/Problem2_InvalidTweets.py @@ -0,0 +1,5 @@ +import pandas as pd + +def invalid_tweets(tweets: pd.DataFrame) -> pd.DataFrame: + invalid=tweets[tweets['content'].str.len()>15] + return invalid[['tweet_id']] \ No newline at end of file