Skip to content

Commit

Permalink
Sync LeetCode submission - Article Views I (pythondata)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimit105 committed Aug 3, 2023
1 parent 6a567ac commit d3a253a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions problems/article_views_i/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
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)
df.rename(columns={'author_id': 'id'}, inplace=True)

df = df[['id']]
return df

0 comments on commit d3a253a

Please sign in to comment.