pyspark 'JavaPackage' object is not callable

141 Views Asked by At

I want to remove the first row of a dataset but this error keeps occuring: 'JavaPackage' object is not callable. I've written another simple program for easier review. Here is my code:


# Create a SparkContext
sc = SparkContext("local", "example")

# Create an RDD
data = [1, 2, 3, 4, 5]
rdd = sc.parallelize(data)

# Retrieve the first element
header_rdd = rdd.first()
print(header_rdd)

Here is the error:

TypeError                                 Traceback (most recent call last)
Cell In[1], line 12
      9 rdd = sc.parallelize(data)
TypeError: 'JavaPackage' object is not callable

what is the solution?

0

There are 0 best solutions below