Selecting a List of Columns in Spark

Unmesha SreeVeni shares how to get a specific set of columns by name from a DataFrame in Spark:

Create a List[Column] with column names.

scala> var selectExpr : List[Column] = List("Type","Item","Price")

<console>:25: error: not found: type Column var selectExpr : List[Column] = List("Type","Item","Price") ^

If you are getting the same error Please take a look into this page .

Read on for the demo.

Related Posts

From pandas to Spark with koalas

Achilleus tries out Koalas: Python is widely used programming language when it comes to Data science workloads and Python has way too many different libraries to back this fact. Most of the data scientists are familiar with Python and pandas mostly. But the main issue with Pandas is it works great for small and medium […]

Read More

Overriding Spark Dependencies

Landon Robinson shows how to override a Spark dependency located on the classpath: This doesn’t draw the line exactly where the method changed from private to public, but generally speaking:– gson-2.2.4.jar: the method is private, and therefore too old for use here– gson-2.6.1: the method is public, and works fine.– Somewhere between the two, the […]

Read More

Categories

March 2019
MTWTFSS
« Feb Apr »
 123
45678910
11121314151617
18192021222324
25262728293031