Complete the function get_only_tweet_language(data). The function takes as input
ID: 3714117 • Letter: C
Question
Complete the function get_only_tweet_language(data). The function takes as input a dataframe of all tweets and returns a dataframe containing only those tweets that are in a language other than any of the user language in the dataset.
the dataframe details is as below.
def get_only tweet_language(data): # YOUR CODE HERE raise Not ImplementedError) return (df) ## Do not change/edit this ce11, it's required for tests in ???? beïo df = get-only-tweet lanquage (df tweets) assert (df. shape==( 937, 11) ) assert(len (df.lang tweet.unique)) 16)Explanation / Answer
I am assuming you are using pandas dataframe. ''' Suppose there are two columns in dataframe - lang_tweet, lang_user. Below function will work. You can change column names if they are different. ''' def get_only_tweet_language(data): user_languages = data.lang_user.unique() data = data[~data.lang_tweet.isin(user_languages)] return data