Practice / selecting and filtering

Rename the Hits

easy

Waveform wants a tidied-up view of its catalog with friendlier column names.

You have the tracks DataFrame:

Your task: return exactly three columns:

  • song — the track's title
  • performer — the track's artist
  • minutes — the duration_sec converted to minutes (duration_sec / 60)

Assign your answer DataFrame to result. Row order doesn't matter.

tracksinput DataFrame

Schema
columntype
track_idlong
titlestring
artiststring
duration_seclong
Sample rows
track_idtitleartistduration_sec
1Neon SkylineThe Glassbirds210
2Paper MoonsAda Vale180
3UndertowThe Glassbirds240
4Slow StaticMarlow150
Expected output shape
songperformerminutes· 4 rows
Hint

Inside one select, rename with .alias(...) and build the new column with an expression: (F.col("duration_sec") / 60).alias("minutes").

Lesson refresher

This problem builds on Selecting & Filtering (~6 min). Pop it open in a new tab if you want a quick recap.

Loading editor…
Hit Run to execute your code and see the output here.