1148. Article Views I
https://leetcode.com/problems/article-views-i
Pandas
import pandas as pd
def article_views(df: pd.DataFrame) -> pd.DataFrame:
return df[
df['author_id'] == df['viewer_id']
][
['author_id']
] \
.drop_duplicates() \
.rename(columns={"author_id": "id"}) \
.sort_values(by="id"
SQL
SELECT DISTINCT
author_id as id
FROM Views
WHERE author_id = viewer_id
ORDER BY author_id