LoslegenKostenlos loslegen

Negating a predicate

You've found that there are a few outlier artists that are skewing your analysis, so you've decided the best course of action is to filter them out. Negate a predicate to remove the artists: "Post Malone", "Taylor Swift", and "BTS".

The DataFrame spotify_df has been created for you.

Diese Übung ist Teil des Kurses

Introduction to Polars

Kurs anzeigen

Anleitung zur Übung

  • Filter spotify_df to show songs by artists NOT in the provided list, excluded_artists.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

excluded_artists = ["Post Malone", "Taylor Swift", "BTS"]

# Filter the DataFrame for songs to exclude these artists
artist_df = spotify_df.filter(____)

print(artist_df)
Code bearbeiten und ausführen