否定述詞
你發現有幾位離群的歌手讓你的分析產生偏差,因此你決定將他們過濾掉。請否定一個述詞以移除這些歌手:「Post Malone」、「Taylor Swift」和「BTS」。
系統已為你建立 spotify_df DataFrame。
本練習屬於課程
Polars 入門
練習說明
- 過濾
spotify_df,只顯示歌手不在給定清單excluded_artists中的歌曲。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
excluded_artists = ["Post Malone", "Taylor Swift", "BTS"]
# Filter the DataFrame for songs to exclude these artists
artist_df = spotify_df.filter(____)
print(artist_df)