+----------------+---------+
|Column Name |Type|+----------------+---------+
| tweet_id | int || content | varchar |+----------------+---------+
tweet_id is the primary key (column with unique values) for this table.
This table contains all the tweets in a social media app.
Write a solution to find the IDs of the invalid tweets. The tweet is invalid if the number of characters used in the content of the tweet is strictly greater than 15.
Tweets table:
+----------+----------------------------------+
| tweet_id | content |+----------+----------------------------------+
|1| Vote for Biden ||2| Let us make America great again!|+----------+----------------------------------+
SELECT tweet_id
FROM Tweets
WHERECHAR_LENGTH(content) >15
1
2
3
4
5
6
7
8
9
10
import pandas as pd
definvalid_tweets(tweets: pd.DataFrame) -> pd.DataFrame:
# Filter rows where the length of 'content' is strictly greater than 15 invalid_tweets_df = tweets[tweets['content'].str.len() >15]
# Select only the 'tweet_id' column from the invalid tweets DataFrame result_df = invalid_tweets_df[['tweet_id']]
return result_df