In python notebook I have some code like below in cell.
---------------
%%file Person.py
class Person(object):
def init(self, name, company):
self.name = name
self.company = company
------------
I execute the above cell code then seen the output like this.
Writing Person.py
-----------
Above file Person.py is stored in data bricks unix file system.
%sh pwd
Ouput : /databricks/driver
----------
%sh ls
Output: Person.py
-------------
Now I want to load this file and import Person class ?
I tried to execute below statements at seperate cells and no use. Please let me know what is missing and why I am unable import that local file into my note book and use!
----------
%load /databricks/driver/Person.py
%load /databricks/driver/Person
%load Person
%run "/databricks/driver/Person.py"
%run "/databricks/driver/Person
etc ......
--------
people = [Person("lak", "tcs"), Person("nag", "cent"), Person("anu", "home")] person_rdd = sc.parallelize(people)
-------
PicklingError: Can't pickle <class 'main.Person'>: attribute lookup main.Person failed
Why are Python custom UDFs (registerFunction) showing Arrays with java.lang.Object references? 1 Answer
While running a application in Apache Spark, gave WARN message 0 Answers
Goose-extractor 0 Answers
How to concatenate/append multiple Spark dataframes column wise in Pyspark? 0 Answers
GDAL installation 1 Answer
Databricks Inc.
160 Spear Street, 13th Floor
San Francisco, CA 94105
info@databricks.com
1-866-330-0121