score:1
Accepted answer
when you call .head
on a dataframe you are returning a row
.
if you look at the size of list1
you will see it only contains a single element.
you need to extract the string at element 0 of the row:
df
.filter($"number"===1)
.select($"letters")
.head
.getstring(0)
.split(",")
.zipwithindex
Source: stackoverflow.com
Related Query
- scala List zipWithIndex different results?
- Scala division by zero yields different results
- Folding a list of different types using Shapeless in Scala
- Scala Stream[Int]#foldLeft and Stream[Int]#sum give different results
- scala way to define functions accepting a List of different numeric types
- Different brackets style on Scala function definition parameter list
- IntelliJ Idea debugger's evaluator gives different results than normal program for comparing Scala Long and Float variables
- Ending filter in Scala on a List after number of successful results
- How to return different results from Futures in Scala without ending up in nested if statements
- Different results from Murmur3 from Scala and Guava
- Scala list of list count different elements per sublist index
- Why do I get different results when using a List than using a Tuple?
- Adding a list from different starting point in Scala
- Create a List from Future results in Scala
- Group a list of Scala Ints into different intervals?
- why are there different results in two scala running environments?
- group by list on same field with different case classes scala
- Populating a list with results from queue within a while loop in scala
- In Scala getting a list from certain items of a different list or file respectivly
- Scala zipWithIndex over a sequence of Strings, do something different with last entry
- Scala function return different results when applied in an UDF
- Shorthand arithmetic operators return different results in Scala - EG: 3 + 2 != 3.+(2)
- Scala list of tuples of different size zip issues?
- why declaration of methods in different style different results in scala
- Scala PartialFunction construction with different results
- Scala overload constructor with mutable List of different type
- Scala parallel collection foreach return different results
- Process the list of different types - is using scala (or functional programming) more expensive than Java?
- How to split a List to be added to a Map in Scala with Different Data Types
- What different between List$SerializationProxy and List in Scala 2.11?
More Query from same tag
- Specs2 ForEach context with execution env
- Scala case class: how to set computed value for a member
- spark json parsing issue
- How to reduce the unwanted type parameter in a generic method?
- How can I override a function of type member in Scala?
- Need help getting through the LiftWeb Getting Started tutorial
- Slick codeGenerator does not fill foreignKey names causing assertion failed: duplicate foreign key names detected
- how to give `x._1._2` parameters actual names
- Play error: value and is not a member of play.api.libs.json
- Upload file after migration from play 2.1 to 2.6 doesn't work anymore
- (Scala) initialize val by looping a list of strings
- Wait for completion of ClosedShape stream
- unexpected behaviour of "grouped" in scala
- is it possible to dynamically name the part-yyyx files based on the value of the column used to partition the dataset?
- Scala Class.getFields
- How to create correct data frame for classification in Spark ML
- In Scala, can internal methods be overwritten in subclasses?
- Traversing multiple JSON arrays in Play/Scala
- Understanding Scala default argument message
- How do I get the scalaz IDEA live templates working for the symbolic methods?
- Troubles with getting case class fields via reflection
- When can Scala's implicitly return null?
- SPARK mapPartitions summing within Partition
- Un-optioning an optioned Option
- Unable to infer SQL type for my user-defined function which return BigInt
- How can I create a ranged projection of a SortedSet with no upper-bound
- How do I nest data from one Spark dataframe in another dataframe based on a condition
- Scala implicit context resolution
- Play Framework Testing using MultipartFormData in a FakeRequest
- how to get values parts from scala without using two for loops?