How do I extract a value of a particular cell in a scala dataframe?

Hi, I’m writing some code to filter the 5 highest results based on a column…

  val cutoff = df.withColumn("rank", dense_rank() over bydf).filter("rank=5").select("amount").collectAsList()

This is giving me


whereas I just want to set 10.5 the numerical value to a variable.

How would I do this?