flaMap gives different output in python and scala

Viewing 0 reply threads
  • Author
    Posts
    • #6502
      DataFlair Team
      Moderator

      I’m trying to use flatMap in my code and was getting different result in spark and Scala. Below is the result which I,m getting

      scala> val x = result.flatMap {line => {val xml = XML.loadString(line); xml.attribute(“Title”) }}

      scala> x.take(2)
      res3: Array[Seq[scala.xml.Node]] = Array(How can I do simple machine learning without hard-coding behavior?, What open-source books (or other materials) provide a relatively thorough overview of data science?)

      Here I m getting array of string , while in python I am getting array of character.

Viewing 0 reply threads
  • You must be logged in to reply to this topic.