I have a large dataframe (more than 100 thousand records
dataframe example:
+-----+---+-----+
|index| X| Y|
+-----+---+-----+
| 0| 1| 8|
| 1| 3| 9|
| 2| 5| 4|
| 3| 7| 0|
+-----+---+-----+
need to put for each row add a new column that will contain an object that should be initialized with data from the original columns is it possible?
I know that when using a pandas, you can put objects in the pandas df, but I don’t know if something like this can be implemented in pyspasrk the desired output looks something like this:
+-----+---+-----+---------------------------------+
|index| X| Y| obj|
+-----+---+-----+---------------------------------+
| 0| 1| 8|<__main__.MyPoint object at 0x01>|
| 1| 3| 9|<__main__.MyPoint object at 0x02>|
| 2| 5| 4|<__main__.MyPoint object at 0x03>|
| 3| 7| 0|<__main__.MyPoint object at 0x04>|
+-----+---+-----+---------------------------------+
can I somehow add a new column and save my object there?