0

I have a data set which looks like this:

   ID   data    name
    0   225.3   player0
    1   185.0   player1
    2   291.0   player2
    3   231.8   player3
    4   337.8   player4

the column 'name' contains unique values.

I want to create an individual class variable for each data point in column "name" using the following class code:

class personName:
    def __init__(self, name, data):
        self.name = name
        self.data= data

There are 1000 plus unique values in the column "name" and i want all those values to have their own class variable, and the name of the class variable is the name in the column "name".

For example:

player0=personName('player0',225.3)

How do I automate to create data for all player names, as I did for 'player0'? Kindly help.

Kshitij Yadav
  • 1,357
  • 1
  • 15
  • 35

0 Answers0