开始使用免费开始使用

对谓词取反

您发现有少数异常的艺术家影响了您的分析,因此决定将他们过滤掉。请对一个谓词取反,以移除以下艺术家:"Post Malone"、"Taylor Swift" 和 "BTS"。

已为您创建 DataFrame spotify_df

本练习是课程的一部分

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)
编辑并运行代码