I have a Spark DataFrame query that is guaranteed to return single column with single Int value. What is the best way to extract this value as Int from the resulting DataFrame?<
You can use head
head
df.head().getInt(0)
or first
first
df.first().getInt(0)
Check DataFrame scala docs for more details