1

I am progrmatically trying to form a dataframe from a string array

var columnNames = df.columns
var df2 = df.select(columnNames) // columnNames is a String[Array]

This is giving me errors though. Is there any other way ?

Leothorn
  • 1,345
  • 1
  • 23
  • 45
  • I spent some time searching for the answer for the question and I have shown where I got the answer from . This will ease the search for questions similar to mine because the original question was tough to find . – Leothorn Mar 18 '16 at 22:45

1 Answers1

3

I got the answer from here

var columnNames = df.columns
var df2 =df.select(columnNames.head, columnNames.tail: _*)
Community
  • 1
  • 1
Leothorn
  • 1,345
  • 1
  • 23
  • 45