1
class MyClass:
      __init__(self, some_string):
             self.some_string = anything

So similar to the DataFrame class of pandas where the columns can be referenced by appending the name of the column after the dot operator.

Like:

df.column_name_of_some_column

But the column name is a string value when read in from a CSV, for example. Hence the DataFrame classed has someway to create a variable from a string value.

How does it do that?

1 Answers1

0

Best option is to use Dictionary and map the keys as per names. You can add variables at runtime. But keep in mind that you don't override the values.

Ankush K
  • 334
  • 3
  • 13